Skip to content

Instantly share code, notes, and snippets.

@wesleywh
wesleywh / CopyUnityEvents.cs
Created August 9, 2020 02:59
This will copy UnityEvents from one UnityEvent to Another. It should copy all the settings exactly as is. Tested on Unity2018.4
public static void CopyUnityEvents(object sourceObj, string source_UnityEvent, object dest, bool debug = false)
{
FieldInfo unityEvent = sourceObj.GetType().GetField(source_UnityEvent, E_Helpers.allBindings);
if (unityEvent.FieldType != dest.GetType())
{
if (debug == true)
{
Debug.Log("Source Type: " + unityEvent.FieldType);
Debug.Log("Dest Type: " + dest.GetType());
Debug.Log("CopyUnityEvents - Source & Dest types don't match, exiting.");
@wesleywh
wesleywh / ExampleReorderableList.cs
Created January 15, 2024 03:23
Unity Custom Right Click Menu To List
#region Editor
public static class PCGSettingsCopier
{
public static PCGSettings obj = null;
public static List<int> indexes = new();
}
[CustomEditor(typeof(PCGSettings), true)]
public class PCGSettingsEditor : Editor
{