Search Issue Tracker

Active

Under Consideration for 6000.6.X

Votes

0

Found in

6000.0.72f1

6000.3.12f1

6000.4.1f1

6000.5.0b1

6000.6.0a1

Issue ID

UUM-138147

Regression

No

Overrides menu allows applying changes to the same Prefab throwing “ArgumentException” error thrown in the Console

Scene Management

-

Steps to reproduce:
1. Create new Unity project
2. Create a Cube in the Hierarchy and name it “1”
3. Drag the Cube to the Project window to create a Prefab and name it “2”
4. Drag the Prefab “2” as a child of Cube “1” in the Hierarchy
5. Select Cube “1” > Inspector > Overrides dropdown
6. Select Prefab “2” and click Apply > “Apply to Prefab “2”
7. Observe the Console window  

Actual results: Overrides menu allows applying changes to “2” Cube when GameObject is already part of the target prefab, throwing “ArgumentException” error in the Console window
Expected results: Overrides menu should not allow applying changes to the same Prefab, no errors thrown in the Console window

Reproducible with versions: 6000.0.72f1, 6000.3.12f1, 6000.4.1f1, 6000.5.0b1, 6000.6.0a1

Tested on (OS): macOS Silicon Tahoe 26.3.1 (a) (M1)

Notes:

{code:java}
ArgumentException: GameObject is already part of target prefab
UnityEditor.PrefabUtility.AddGameObjectsToPrefabAndConnect (UnityEngine.GameObject[] gameObjects, UnityEngine.Object targetPrefab) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Prefabs/PrefabUtility.bindings.cs:316)
UnityEditor.PrefabUtility.ApplyAddedGameObjects (UnityEngine.GameObject[] gameObjects, System.String assetPath, UnityEditor.InteractionMode action) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Prefabs/PrefabUtility.cs:1983)
UnityEditor.PrefabUtility.ApplyAddedGameObject (UnityEngine.GameObject gameObject, System.String assetPath, UnityEditor.InteractionMode action) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Prefabs/PrefabUtility.cs:1930)
UnityEditor.SceneManagement.AddedGameObject.Apply (System.String prefabAssetPath, UnityEditor.InteractionMode mode) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverride.cs:189)
UnityEditor.SceneManagement.PrefabOverride.Apply (System.String prefabAssetPath) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverride.cs:22)
UnityEditor.PrefabOverridesTreeView+ComparisonViewPopup.Apply (System.Object prefabAssetPathObject) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Prefabs/PrefabOverrides/PrefabOverridesTreeView.cs:822)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[] options, System.Int32 selected) (at /Users/bokken/build/output/unity/unity/Editor/Mono/GUI/GenericMenu.cs:160)

{code}

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.