It is my understanding that when two objects collide that have colliders attached to them, the collision automatically gathers information such as the tag of the two objects colliding. If this is so the code below should run rather fast as it would not require looking up Tags and such. So to summarize, is this correct, and this type of code wouldn’t incur any extra overhead?
Thanks GroZZler! I was fairly certain that was the case, but I wanted to get some input from others before I started relying on this type of code throughout my project.
Tag checking is fine for small games or prototypes. But it gets complex to manage when you have a dozen or so different tags around. Your if/switch statements quickly become massive and unreadable.
Thats a good point BoredMormon. I think I will be ok cause I only foresee me using one or two tags at the most. I will certainly keep your suggestion in mind though.