Search Issue Tracker

Won't Fix

Votes

1

Found in

2018.4

2019.4

2020.2

2020.3

2020.3.2f1

2021.1

2021.2

Issue ID

1325788

Regression

No

Multiple errors appear in the Console when closing a Scene that contains nested Prefab with HideFlags set to DontSave

Scene Management

-

How to reproduce:
1. Open the user's attached project
2. In the top bar menu select BugRepro > Reproduce Bug Step 1
3. Select BugRepro > Reproduce Bug Step 2
4. Observe the Console

Expected result: No visible errors present
Actual result: Multiple errors appear in the Console

Reproducible with: 2018.4.33f1, 2019.4.24f1, 2020.2.7f1, 2020.3.3f1, 2021.1.2f1, 2021.2.0a7

Notes:
- The following error appears in the Console:
Cannot destroy GameObject that is part of a prefab instance.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Can't remove TestScript2 (Script) because TestScript1 (Script) depends on it
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Can't destroy Transform component of 'Sphere'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
Sphere
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

  1. Resolution Note (2021.2.X):

    You must manually apply the flag to the entire hierarchy of game objects you desire to affect.
    For Prefab instances in a scene you can set the hideflag on the Prefab instance handle object as a way to set the same hideflags on all the objects of the the Prefab instance (see PrefabUtility.GetPrefabInstanceHandle).

Add comment

Log in to post comment