Question by
LocketGoma · Aug 11, 2017 at 06:53 AM ·
tagtagging
i don't know why tag option is dosen't work
in my project. i use some tags.
but my new tag is maybe doesn't work.
has some picture
red square : '1' it sprite tag is 'Key' so, as far as i know if i checked '(Collider2D).gameObject.tag' is 'Key'.
but
is return 'untagged'
i don't know why return untagged.
used other tags are work well. just that tag isn't work.
how can i do use tag?
here is my some codes.
void OnTriggerEnter2D (Collider2D other) {
print(other.gameObject.tag);
print(other.gameObject.layer);
if (other.gameObject.tag == "Key")
{...}
}
사용자-지정-1.png
(55.9 kB)
사용자-지정-2.png
(5.1 kB)
Comment
oops. i already solve this problem.
is just crossed tag detection.
Your answer
![](https://koobas.hobune.stream/wayback/20220612131413im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Find closest object with a certain tag 2 Answers
Usage of multiple tags or some other workaround? 1 Answer
Multiple tags for one GameObject 3 Answers
Change music when enemy is in scene 0 Answers
Tag Editor is all grayed out 0 Answers