• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Alan · Dec 23, 2010 at 08:16 PM · iphonetag

UnityException: GameObject has undefined tag! Xcode console message

I get this error when I run my game made using Unity iPhone version 1.7 on my iPod Touch through Xcode's debugger. The exact error message is:

UnityException: GameObject has undefined tag! items.OnTriggerEnter (UnityEngine.Collider other)

(Filename: Line: -1)

It gets spammed a bunch of times in console and as far as I can tell I have all of the tags defined in the Unity Tag Manager. The error does not appear when run on my desktop, only on the iPod. Here is the bit of code, items.OnTriggerEnter:

function OnTriggerEnter (other : Collider){

if(other.tag=="playerBody" || other.tag=="playerHead" || other.tag=="Player" || other.tag=="playerFeet") { ObjectManager.getInstance().ReturnGem(gameObject); Collide(); }

}

How do I get rid of this error?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

7 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Radical · Sep 02, 2017 at 09:04 AM

I was seeing the same error message when running on Android, but not within the editor. The same logic error was occurring on iOS, but I haven't checked the logs to see if this was the exact error message.

This particular project was upgraded from Unity 4 to Unity 5.6.1f1. What I found is that in Project Settings | Tags and Layers there were a few tags marked as "Removed", and a message from Unity stating that they would actually be removed the next time the project was loaded. Unfortunately, reloading the project would never remove them.

My hunch was that Unity was in a state where it thought the tags were up to date, and that there was nothing to do to them at project load.

The answer was to add a temp Layer, save the project, then reload the project. I restarted Unity just to be safe. The "Removed" tags were then actually removed, and everything is now working properly on Android builds. I'll test iOS as well, but I would bet money it's fixed as well.

My assumption is that making a change (adding a layer) marked a dirty flag internally and Unity's cleanup logic at project load now saw that there was a change to the Tags and Layers and did it's normal processing. The tags probably got screwed up when upgrading the project from Unity 4 to Unity 5. That I don't know. The tags look fine in Unity 4.

Afterwards, I did of course remove the temp layer.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Grumshow · Dec 03, 2017 at 10:39 PM

Just wanted to comment here in case anyone had the specific problem I had in relation to this, that I solved using the method mentioned by @omarwaleed and @FlameHaze-Yuki

I had a Character controller landing on a moving platform, and was changing the parent to the platform in order to have the player move with the platform. This was done using a Trigger box collider that I tagged "platform" after a couple of typos and removed tags.

This worked great in the editor, but when I built to the android device the player would just slide off like the event OnTriggerEnter was not happening. I also tried OnTriggerStay, to no avail. I also tried searching Google for "OnTriggerEvent not firing on Android" and "Parenting CharacterController."

It was only after opening Android Monitor in Android Studio and seeing the error "UnityException: GameObject has undefined tag!" pop up, that I found this thread and solved by restarting Unity. Definitely going to be my go to first attempt at any future problem solving!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • ‹
  • 1
  • 2

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

little animated loading disc thing in iOS 0 Answers

Strange collision problem with block and terrain 1 Answer

How to make my function only search for objects in the same axis? Code included... 1 Answer

HUGE Texture problems on iPhone when using animated UVs 2 Answers

handling collision with two objects of the same tag 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges