- Home /
Collision Detection for a Prefab
So I've been digging through the forums, and I haven't been able to find anything regarding collision detection of a specific prefab. I'm trying to create a simple arkanoid/breakout-style game(i.e. a paddle is used to hit a sphere back and forth against a set of destructible bricks), so naming each individual brick for the sake of detection is out of the question (this point is probably redundant, since I've already mentioned my intent to use prefabs). Any help would be appreciated. Thanks!
Answer by sparkzbarca · Nov 10, 2012 at 08:29 AM
well all the prefabs will respond in the same way right?
you attach a script to the prefab that tells it what to do on collision.
all instances of that prefab will have that script attached to them so all will behave according the script.
I actually did what you suggested before I turned to this forum for help, but I ran into an issue where if my GameBall object collided with a blue brick prefab, the ball would end up destroying another blue brick that was untouched. That's my current problem, which I will post in a separate topic. Thank you sir!