Custom Editor need for Awake function called when game starts
Hi guys! My custom bot editor script has a series of actions and a toggle next to each one. Based on which toggles are set the bot script knows which actions are active by storing them in a list. After that it the update in runs through the list and start actions.
Reference image :
I use reflection in order to get the actions from the bot class. The issue appears when I run the game and I am the game object is not selected. Thus neither OnEnable()
nor OnInspectorGUI()
get called.
I need a way to pass the knowledge of the state of toggle to the bot class right? But if there is no method overload to run in the editor code than the information never gets sent. Also, when dealing with multiple bot game objects the issue becomes quite serious. I have to manually click on each one just for the inspectorGUI to work.
Is there a better way? How can I manage to do this? It feels quite simple to me. Also tried adding [RuntimeInitializeOnLoadMethod]
decorator. Even Awake() is called when the game object is active. I am not really sure this is the intended behavior.
Thanks in advance !
Your answer
Follow this Question
Related Questions
Custom editor, float not saving when enter playmode. 1 Answer
Create a list of custom editors 0 Answers
OnGUI will not show up? 1 Answer
Why isn't my object lerping ? C# 2 Answers