ExecuteAlwaysattribute do not receive
ExecuteInEditModeattribute, meaning that there are errors thrown when enabling either of these options. We will tackle this in this guide, read how to below.
GlobalIDscript with your scripting environment (like Visual Studio) and check the references of the class. It is very unlikely for a module to use the
ExecuteInEditModeattribute. Once found out, follow the instructions below.
Singleton<T>. We add the following code after the "Constructor" comment and before the
RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]is called, the method
Initgets executed which resets the static variable
instanceand sets the
IS_Exitingbool variable to false. Normally, the second one is not necessary, but with Reload Scene disabled, the method
OnRuntimeStartSingletonis not executed and thus we need to set it.
<className>.Init();tells the manager to be initialized (reset) when the play mode is entered.
GlobalID, also uses the
ExecuteInEditModeattribute. This means we can't use the
Awakemethod. We need to change it like this for all classes that derive from
initializedStats, with the value false
Awakemethod, rename it to
GlobalIDclass, add the
Overridekeyword after the modifier if it is not already there
OnEnablemethod, merge the two of them together, whereas the code of the old
OnEnablemethod after the closing of the if condition comes
Physics 2D Raycasterto the main camera. When Reload Scene is deactived, Unity doesn't check the gameobjects whether they have dependencies to the named components and thus won't add them.