Created
March 14, 2021 17:19
-
-
Save srcnalt/729c9b7b4f0002c6581b259939172692 to your computer and use it in GitHub Desktop.
Some functions for editor programming in Unity3D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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