CompareTag

VisualStudio kept telling me that collision.tag == “Package” is inefficient and i should use collision.CompareTag(“Package”);

Not sure if .tag is getting phased out or not. Just thought i’d mention it.

1 Like

Just decided to look it up myself. It looks like it’s not so much that it’s getting phased out, but more just that due to implementation of CompareTag it results in a bit better performance.

More details can be found on this post: Is CompareTag better than gameObject.tag performance wise? - Unity Answers

It’s not being phased out , just more performant to use .CompareTag (less garbage created by the strings)

I had to move to VS Studio on Mac was having issues with code. If you are like me and hate seeing things like that I had to change it lol. The code works

Privacy & Terms