Search Issue Tracker

Fixed in 2020.2.X

Fixed in 2019.3.X, 2020.1.X

Votes

1

Found in

2019.3.0a3

2019.3.0f5

2020.1

Issue ID

1214727

Regression

Yes

"UnityException: GameObject has undefined tag!" thrown when setting a Tag and saving Scene if other Tag was removed beforehand

Scene Management

-

To reproduce:
1. Open attached project ("case_1214727.zip")
2. Open Edit > Project Settings > Tags and Layers
3. Remove Tag 0 "remove"
4. Select "Test" Game Object in Hierarchy
5. In the Inspector window set the Tag to "select" and save the Scene
6. Observe the console

Expected result: No errors are thrown
Actual result: "UnityException: GameObject has undefined tag!" errors are thrown

Reproducible in: 2019.3.0a3, 2019.3.0f6, 2020.1.0a21
Not reproducible in: 2017.4.36f1, 2018.4.16f1, 2019.2.20f1, 2019.3.0a2

Notes:
1. Entering the Play mode resolves the issue
2. After reproduction, Inspector window for selected Game Object remains blank

  1. Resolution Note (fix version 2020.2):

    Fixed in 2020.2.0a11

  2. Resolution Note (fix version 2020.1):

    Fixed in 2020.1.0b9

  3. Resolution Note (fix version 2019.3):

    Fixed in 2019.3.15f1

Comments (2)

  1. simonandmeganuxp

    May 21, 2020 05:53

    To reproduce from scratch in 2019.3.5f1:
    Add a 3D object to the scene in Hierarchy.
    Add a custom tag and assign it to the object.
    Drag the object to the Assets folder to create a prefab.
    Delete the object from the Hierarchy.
    Edit the list of tags by either editing a different object or clicking Edit Menu -> Project Settings... -> Tags and Layers.
    Delete the tag from the list of tags (can't delete tag if there is still an object in the hierarchy using that tag).
    Select the prefab and this will throw the error.

    The issue is that if you edit the prefab, the tag appears to be valid because it shows as being the selected tag. If you then check your Tags and Layers it appears there too but I think that under the hood it hasn't actually been added to the list.

    To fix:
    Select the model that is causing the issue and change the tag to something else. The original tag will still be in the list so you can choose the original tag again and everything works again with no errors.

    Cheers!

  2. PicoPlanetDev

    May 02, 2020 14:16

    This is happening to me - 2019.3.10f1

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.