How to edit script templates: https://support.unity.com/hc/en-us/articles/210223733-How-to-customize-Unity-script-templates
Editor GUI Layout
EditorGUILayout.BeginHorizontal();
.. your code ..
EditorGUILayout.EndHorizontal();
Sintassi più pulita e che rimuove il rischio di scordarsi di chiudere il layout
using (new EditorGUILayout.HorizontalScope()){
.. your code ..
}
Layout Options
Posso passare a GUILayoutOption una funzione per definire delle caratteristiche ad esempio : GUILayout.Height();
if (GUILayout.Button("Disable/Enable all enemy", GUILayout.Height(40))){
foreach (var enemy in GameObject.FindObjectsOfType<EnemyBehaviour>(true)){
enemy.gameObject.SetActive(!enemy.gameObject.activeSelf);
}
}
Colorare un elemento
GUI.color = Global tinting color for the GUI
GUI.contentColor = Tinting color for all text rendered by the GUI
GUI.backgroundColor = Global tinting color for all background elements rendered by the GUI
var cachedColor = GUI.backgroundColor;
GUI.backgroundColor = Color.green;
// The button’s code
GUI.backgroundColor = cachedColor;