-
-
Save kirevdokimov/995cfc7b8b3bbfa07791405191fc426b to your computer and use it in GitHub Desktop.
456
This file contains 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
====================================================================================================== | |
ObjectField | |
var newMaterial = (Material) EditorGUILayout.ObjectField("Material", currentMaterial, typeof(Material),false); | |
====================================================================================================== | |
static void ShowReadonlyIntField(string name, int value){ | |
EditorGUILayout.BeginHorizontal(); | |
GUILayout.Label(name, GUILayout.Width(EditorGUIUtility.labelWidth)); | |
GUI.enabled = false; | |
EditorGUILayout.IntField(value); | |
GUI.enabled = true; | |
EditorGUILayout.EndHorizontal(); | |
} | |
====================================================================================================== | |
HelpBox | |
GUILayout.BeginVertical(EditorStyles.helpBox); | |
GUILayout.Label("Title"); | |
GUILayout.Label("Description", EditorStyles.wordWrappedMiniLabel); | |
GUILayout.EndVertical(); | |
====================================================================================================== | |
// Позволяет менять фон кнопки (возможно и других элементов, но это нужно тестировать) | |
GUI.backgroundColor = Color.blue; | |
GUILayout.Button("X"); | |
====================================================================================================== | |
GUI элементам можно задавать несвойственные им стили через | |
EditorStyles. или GUI.skin. или можно задавать даже строками e.g. "miniButton" (но такого, думаю, лучше избегать) | |
void OnGUI{ | |
bool b = GUI.Toggle(rect, value, text, GUI.skin.button); | |
} | |
====================================================================================================== | |
Можно подписываться на события Undo Redo | |
Undo.undoRedoPerformed += OnUndoPerformed; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment