- Home /
UnityException, Builds Only: "Tag __ is not defined"
I'm building a game since January, and for almost a month I've seen different problems when building a new version.
It all started with functionality loss: my Player was able to attack, but not walk. There was no error with the scripts, the whole game works fine inside Unity. After some research, I found out that there is a bug where Unity won't compile every script and things like that, so I've tried to move all my scripts to Standard Assets, reimport everything, reinstall Unity, etc. After some time, this problem stopped, but a new one started and I can't solve it.
The problem now is with my Loading Screen. What the script do is find the Canvas (with the tag "Canvas") inside the Scene, instantiate a new image inside and call the next scene with LoadLevelAsync. The whole script worked fine in previous builds, and still works as supposed inside Unity, but when I build a new version of the game, it always returns the error "UnityException: Tag: Canvas is not defined.". The thing is, the tag is defined, as it works normally inside the Editor.
I've tried everything as before, reinstalled Unity, moved scripts around, reimported everything; but this time nothing worked. Any ideas how else I could solve this?
Try to remove and re-add the tag in the Tag $$anonymous$$anager. Try to change
gameobject.tag = "Canvas";
to
gameObject.CompareTag("Canvas");
or vice versa.
I've tried as suggested, removed and re-added the tag in the Tag $$anonymous$$anager with no success. Something funny happened though, while trying to change Tags and creating new ones to see if something happened, the $$anonymous$$anager suddenly appeared once with all Tags lost. I tried re-opening Unity (as this proved to be a marvelous unexplained bug fixer during the last few weeks)and the error changed. Now it said the problem was with a NullReference Exception in my LevelLoader script. As I knew the scripts were fine (since I haven't changed a single line of code during this process and they were working as expected inside the Editor), I've asked Unity to Reimport everything. When it finally ended, there was no error left, and I couldn't find anymore problems inside the Build (for now)! Thanks for the help :)
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Android - Error building Player: CommandInvokationFailure: Failed to re-package resources 3 Answers
My android app build has more bugs on it than the editor/deveploment version 0 Answers
Failed to resolve UnityEngine.XR.XRSettings 2 Answers
Build failure: Failed to build apk 0 Answers