Search Issue Tracker
Won't Fix
Votes
2
Found in
2018.2.8f1
Issue ID
1081461
Regression
No
Unity freezes when using SceneManager.LoadScene in the childed GameObject
How to reproduce:
1. Open user's project
2. In the Hierarchy select "[GameManager]" and make it a child of "Systems"
3. Press Play
Expected result: Unity does not freeze.
Actual result: Unity freezes.
Reproducible with - 2019.1.0a1, 2018.3.0b2, 2018.2.8f1, 2018.1.9f2
Not reproducible with - 2017.4.11f1 (missing prefabs, can't fix it)
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 (2021.2.X):
The user calls LoadScene from Awake and this generates infinite loop.
private void Awake()
{
if (Instance != null)
{
Destroy(gameObject);
}
else
{
Instance = this;
DontDestroyOnLoad(gameObject);
RestartGame();
}
}
...
private void RestartGame()
{
Lives = 3;
coins = 0;
SceneManager.LoadScene(0);
if (OnLivesChanged != null)
OnLivesChanged(Lives);
if (OnCoinsChanged != null)
OnCoinsChanged(coins);
}
When "[GameManager]" is a child of any other object DontDestroyOnLoad doesn't work if its parent chain is not marked as DontDestroyOnLoad
I will update the documentation for DontDestroyOnLoad to reflect this requirement.