Search Issue Tracker
By Design
Votes
0
Found in
5.3.1f1
Issue ID
757357
Regression
Yes
Unity crashes when using "Object.DontDestroyOnLoad(this);" because of memory leak
Steps to reproduce:
1. Open attached project.
2. Open scene named "MoveCubeAB".
3. Enter the play mode.
4. Wait for some time (until the controller reaches connection point).
Actual result:
Unity crashes ("Unity Editor has stopped working" window appears).
Expected result:
The "Console" window should inform the user and prevent him from entering the play mode when a specific line of code might cause a crash.
Reproduced with:
5.3.4f1, 5.3.5f1, 5.3.5p1, 5.4.0b18.
Cannot reproduce with:
5.1.0f3, 5.2.4f1.
Note:
GIF attached.
Error messages that are output by the "Console" window while in play mode (however they allow the user to enter the play mode):
"InvalidOperationException: The following game object is invoking the DontDestroyOnLoad method: CurvyGlobal. Notice that DontDestroyOnLoad can only be used in play mode and, as such, cannot be part of an editor script.
FluffyUnderware.Curvy.CurvyGlobalManager.Awake () (at Assets/Packages/Curvy/Base/CurvyGlobalManager.cs:229)"
"NicifyVariableName is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'CurvySplineSegmentEditor'.
See "Script Serialization" page in the Unity Manual for further details.
UnityEditor.ObjectNames:NicifyVariableName(String)
FluffyUnderware.DevToolsEditor.DTGroupNode:.ctor(String, SerializedProperty, RenderAsEnum) (at Assets/Packages/DevTools/Editor/DTEditorClasses.cs:482)
FluffyUnderware.DevToolsEditor.DTEditor`1:.ctor()
FluffyUnderware.CurvyEditor.CurvyEditorBase`1:.ctor()
FluffyUnderware.CurvyEditor.CurvySplineSegmentEditor:.ctor()"
"Cleaning up leaked objects in scene since no game object, component or manager is referencing them
Texture2D has been leaked 4 times."
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- URP Realtime reflection probes do not update when RenderProbe() is being called once per second
- Addressable terrain shader variants are stripped from the Player
- [iOS] Debug.Log() appears as <private> in Console app
- UI stays in the background when it is disabled in simulator
- A wrong log file is attached when project is launched with a "-logFile" command line argument
Add comment