Timeline for How to make multiple types of game objects destructible
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 8, 2020 at 4:12 | comment | added | Anatolii |
Thanks for your reply! Actually I'm using a tag for damageable objects already - Physics.OverlapSphere(transform.position, m_ExplosionRadius, m_DamageableMask);. m_DamageableMask is the tag. But what is not clear is if it's a good practice in Unity to add the same script to every child that should be damageable.
|
|
| Dec 7, 2020 at 18:14 | comment | added | NCarlson | Good advice, I agree .CompareTag() is probably better. I honestly haven't used the collision system lately. Since you have more suggestions you should post an answer :) | |
| Dec 7, 2020 at 17:49 | comment | added | DMGregory♦ |
If you're going to compare tags, favour using .CompareTag() over .tag == for efficiency. But I'd recommend physics layers over tags at all. With physics layers, you can filter your collisions/triggers before the callback even gets called, rather than going to all the work of finding the collision handlers and calling them only to result in a no-op.
|
|
| Dec 7, 2020 at 16:12 | review | First posts | |||
| Dec 8, 2020 at 9:24 | |||||
| Dec 7, 2020 at 16:09 | history | answered | NCarlson | CC BY-SA 4.0 |