Hello, I have an editorscript and I want to have a togglegroup with an objectfield in it.
First Question: Is it possible to just use a public variable in my normal script or do I HAVE to make an objectfield in the editorscript.
Second: How do I make an objectfield. I have seen the reference: Unity - Scripting API: EditorGUILayout.ObjectField
but it doesn’t work. Now when i try it myself I get stuck at the GUIlayoutoptions parameter.
Anyone got an example?
var t = target as DayOrNight;
if(true) {
t.BlendValue = EditorGUILayout.FloatField("Blend Value", t.BlendValue);
}
t.DayColor = EditorGUILayout.ColorField("Day Color", t.DayColor);
t.NightColor = EditorGUILayout.ColorField("Night Color", t.NightColor);
groupEnabled = EditorGUILayout.BeginToggleGroup("Has Light", groupEnabled);
t.rotatingLight = EditorGUILayout.ObjectField("light source", t.rotatingLight, typeof(Light),false) as Light;
EditorGUILayout.EndToggleGroup();
if(GUI.changed) {
EditorUtility.SetDirty(t);
}