Skip to content

Instantly share code, notes, and snippets.

@srcnalt
Created March 14, 2021 17:19
Show Gist options
  • Save srcnalt/729c9b7b4f0002c6581b259939172692 to your computer and use it in GitHub Desktop.
Save srcnalt/729c9b7b4f0002c6581b259939172692 to your computer and use it in GitHub Desktop.
Some functions for editor programming in Unity3D
private void Vertical(Action content, bool isBox = false)
{
EditorGUILayout.BeginVertical(isBox ? "Box" : GUIStyle.none);
content?.Invoke();
EditorGUILayout.EndVertical();
}
private void Horizontal(Action content, bool isBox = false)
{
EditorGUILayout.BeginHorizontal(isBox ? "Box" : GUIStyle.none);
content?.Invoke();
EditorGUILayout.EndHorizontal();
}
private void ObjectArrayField(string objectName)
{
SerializedObject so = new SerializedObject(this);
SerializedProperty property = so.FindProperty(objectName);
EditorGUILayout.PropertyField(property, true);
so.ApplyModifiedProperties();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment