Okay, so imagine the following scenario -> I have 10 tanks on the grounds, the same type units. My first idea was to add a script to that tank type prefab, which waits and reacts when user clicks on it and from then on.. That way all of my tanks would have a code for them selfs, running in the background, and it would be all tidy and clean, not a single C# code with thousands if statements for raycast checking..
BUT, I can't use tags.. :/ I mean, if I have basically the tag "tank_type_01", and check raycast against that tag, when I click on that single unit, all of the corresponding tanks (since they're all prefabs, and all are of type tank_type_01) would react as well.. :/ How can I control if the user has clicked just on that particular tank, what are other options except tags? Is there something like "if (physics.....) if (this boxcolider).." since each tank has box colider on it?
Thanks!
↧