Hi guys,
I have a Monobehaviour script assigned to a GameObject for editing some objects in edit mode.
When I press run I wish that some methods run only in the game mode.
I tried:
#if UNITY_EDITOR
#endif
but doesn’t work…
Hi guys,
I have a Monobehaviour script assigned to a GameObject for editing some objects in edit mode.
When I press run I wish that some methods run only in the game mode.
I tried:
#if UNITY_EDITOR
#endif
but doesn’t work…
Doesn’t work how? Pressing ‘run’ only happens in Editor, so you must be in the Editor.
Thx! It works ![]()
If you only want certain things in the Build, you can also use if (!Application.isEditor) or #if !UNITY_EDITOR.