In the Brick Breaker lesson, we were taught about tags on GameObjects. Is there any reason not to use tags to define whether or not enemies can hit themselves/each other with shots instead of carefully positioning the enemy beams to appear below their own hitbox?
I mean, I know it works (that’s one of the things I used) but I’m curious if Unity tags are inherently flawed in some way (ie, they cause lag, they’re not performant, etc) or if this solution was just not chosen for the tutorial for the sake of simplicity or something. Not that it’s hard - you just modify the “if (collision.GetComponent())” if statement inside your enemy ship controller to “if (collision.GetComponent() && collision.tag != “EnemyShot”)” and make sure your enemy shot prefab has a tag.
Or… you could put things on various physics layers, then go into ‘Project Settings’, ‘Physics2D’ and make sure that the EnemyShots layer doesn’t interact with the Enemies layer, and the PlayerShots doesn’t interact with Players, and that EnemyShots doesn’t interact with PlayerShots…
It just strikes me that there’s a couple of things that seem like they’d be easier solutions than finding the exact right pixel height to create an enemy shot and hope that the lasers don’t fire.
Edit: That’s it, I’m not going to ask anything until I finish the series. Immediately after this lesson there’s a video called ‘Controlling collisions with layers’ oh jeez time to start looking ahead