Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development

Angus Eliott
Angus Eliott
3,793 Points

What is missing!??!?

am programming a game on unity "Frogs'n'Logs". MVS (Microsoft Visual Studio) came up with the error:

Severity    Code    Description Project File    Line    Suppression State
Error       UnityException: Tag: player is not defined. Solution 'Frogs and Logs' ‎(3 projects)   Assets/Scripts/FlyPickup.cs 9

My code:

using UnityEngine;

public class FlyPickup : MonoBehaviour
{

    void OnTriggerEnter(Collider other)
    {
        // if the collider "Other" is tagged with player...
        if (other.CompareTag("player"))
        {
            Destroy(gameObject);
        }
    }
}   

Thank you!

Steven Parker
Steven Parker
231,248 Points

Did you intend to put this question in the "Game Development" category? You can still change it by clicking on the box with the three dots and chosing "edit question".

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I agree with Steven Parker. While the code inside the Game Development track is done in C#, this particular question references material specifically associated with the Game Development track. As such, I'm going to move your question over to the correct category, which will hopefully facilitate in getting a speedier answer! :sparkles:

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Angus Eliott! I believe you have simply made a typo. It's saying that the "player" tag is undefined, because it is undefined. There is, however, a "Player" tag. Remember, capitalization matters. Just about everything is case-sensitive. Try correcting the lower case p to an upper case P and see if it works!

Hope this helps! :sparkles: