Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

TAG question

Discussion in 'Scripting' started by MrKory, Aug 26, 2016.

  1. MrKory

    MrKory

    Joined:
    Sep 20, 2013
    Posts:
    66
    Hi,

    I am having an issue where the following occurs..

    I have objects(pickups) that the player picks up. The player has a TAG "PlayerFPS", which is using the OnTriggerEnter to trigger the pickup. This works perfectly as expected. Now, if I go and change the TAG on the player and also change the TAG name in the script the pickups are no longer picked up. Where this gets hard for me to understand is that the TAG that I want to use is part of an A* "full project" which when applied to the player won't allow the pickup to be picked up, and the current TAG(in my script) is not visible to A* as a TAG selection... very confusing.. What am I missing?

    I really apologize if this doesn't make much sense. I can post info more if needed.

    Thanks!
    -Kory
     
  2. MrKory

    MrKory

    Joined:
    Sep 20, 2013
    Posts:
    66
    Quick update... So it appears that a specific layer is actually causing the issue and not the TAG. Does this make sense to anyone?

    Thanks
    -Kory
     
  3. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    Check out the layer collision matrix here: https://docs.unity3d.com/Manual/LayerBasedCollision.html

    Layers can be set to allow or disallow collisions with any other layers in the Physics options. The layer collisions determine what actually activates the OnTriggerEnter/Stay/Exit and OnCollisionEnter/Stay/Exit, but the tags are often used to differentiate between objects within that same layer (a power-up item or a key-item or just bonus points, for instance).
     
    MrKory likes this.
  4. MrKory

    MrKory

    Joined:
    Sep 20, 2013
    Posts:
    66

    The issue was with the layer... Everything works!! Thank you!!