Search Issue Tracker
By Design
Votes
0
Found in
2018.3.0f2
Issue ID
1115120
Regression
No
Disabled scripts still call Awake function
To reproduce:
1. Open attached project "awakescript.zip"
2. Select "GameObject" from the hierarchy
3. Make sure that "Testing.cs" script is enabled
4. Enter Play mode
5. Observe the console "Awoken!" and "Starting" logs
6. Exit Play mode and disable the script in the game object
7. Enter Play mode and observe the console
Expected result: no logs are printed in Play mode when the script is disabled
Actual result: Awake function is still called even though the script is disabled
Reproduced on:
2017.4.0f1 2017.4.23f1 2018.3.8f1 2019.1.0b6 2019.2.0a8
Notes:
Reproduced with .NET3.5 and .NET4.x
If the Game Object is disabled then the function is not called.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Highlighter.Highlight does not find window when using class name as window title
- Highlighter.Highlight highlights a different component when multiple components have the same property path
- Highlighter.Highlight does not find elements in an array or list when the array or list is collapsed
- [URP][NRP] RenderPass, BeginSubPass, and EndRenderPass errors are thrown when Native RenderPass is enabled
- D3D11 swapchain error pop-up appears and the Editor shuts down when Generating Lighting with Probe Volumes present
Resolution Note (2019.2.X):
MonoBehaviour.Awake is always called, regardless of whether the MonoBehaviour is enabled or not. Awake acts as a replacement for the C# constructor from which you can all Unity APIs.