Skip to content

Instantly share code, notes, and snippets.

View ByronMayne's full-sized avatar

Byron Mayne ByronMayne

View GitHub Profile
@ByronMayne
ByronMayne / CollapsableEventDrawer.cs
Last active September 27, 2022 19:04
Override the default UnityEventDrawer to draw a very small version when there are no callbacks.
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Events;
[CustomPropertyDrawer(typeof(UnityEvent))]
public class CollapsableEventDrawer : UnityEventDrawer
{
@ByronMayne
ByronMayne / AssemblyUtility.cs
Created January 20, 2018 18:33
A simple method to force Unity Editor to recompile all scripts.
public class AssemblyUtility
{
/// <summary>
/// Forces Unity to recompile all scripts and then refresh.
/// </summary>
public static void DirtyAllScripts()
{
// Grab the UnityEditor assembly
Assembly editorAssembly = typeof(UnityEditor.Editor).Assembly;
// Find the type that contains the method we want