gameController = gameObject.FindObjectOfType ();
2 Answers
2What “triple curly brackets”? If that one posted line is what you’re asking about, the FindObjectOfType method requires an input parameter that indicates the object type you’re interested in finding.
See the docs here:
https://docs.unity3d.com/ScriptReference/Object.FindObjectOfType.html
@jdgorfrey
sorry i meant it was in bold
[EditorUtility.SetDirty][1] or [Undo.RecordObject][2] probably. Use one of these methods to tell the Editor's SerializedObject that you changed some of its properties. Avoid doing it every frame of OnInspectorGUI, instead only do it when the object returned from EditorGUILayout.ObjectField is not equal to the old value. [1]: https://docs.unity3d.com/ScriptReference/EditorUtility.SetDirty.html [2]: https://docs.unity3d.com/ScriptReference/Undo.RecordObject.html
– ElijahShadbolt
It is nothing special, one could rewrite it as public bool StartTemp; /* without [HideInInspector] / ... DrawDefaultInspector(); RandomScript script = (RandomScript)target; / without EditorGUILayout.Toggle */ if (script.StartTemp) { ... } However, to make it easier to group the toggle field with the hidden fields, I chose to draw it after all the other non-HideInInspector fields (not shown in the example), in case any fields are added when the script is modified by someone else.
– ElijahShadbolt