Timeline for Touch through GameObject, best practice
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 5, 2015 at 8:34 | comment | added | ElDuderino | I tried with the layermask and it works. See my answer below. | |
| May 5, 2015 at 8:33 | answer | added | ElDuderino | timeline score: 1 | |
| May 4, 2015 at 15:23 | comment | added | user30331 | No, cache the reference to the collider component itself. | |
| May 4, 2015 at 15:15 | comment | added | ElDuderino | You are right, I should cache those gameobjects somewhere... but It's not a difference if I do GetComponent<Collider>() or GetComponent<ScriptWithReferenceToCollider>() on the gameobject afaik... | |
| May 4, 2015 at 14:00 | answer | added | Heisenbug | timeline score: 1 | |
| May 4, 2015 at 13:43 | comment | added | user30331 | You could store a reference to these colliders on start, or when you instantiate the monster. Then use them from there. Even if you do it this way, how many components does the monster have? Probably not more than 10. A linear search through 30 of them should be nothing, especially if this is only for one frame. I'd be more worried about the FindGameObjectsWithTag method. | |
| May 4, 2015 at 13:30 | history | asked | ElDuderino | CC BY-SA 3.0 |