- Home /
Finding Collider of Prefab
Hi, I'm trying to recreate the FPS tutorial in 3rd person and am having some trouble.
I created a prefab with an attached rigidbody and multiple children with primitive colliders. I have a bullet script that creates a bullet and shoots it, but wanted to ignore collisions with the player. When I call:
Physics.IgnoreCollision(newBullet.collider, transform.root.collider);
I get the following error:
MissingComponentException: There is no 'Collider' attached to the "player" game object, but a script is trying to access it.
Am I wrong to assume that if I attach a rigidbody to the parent GameObject of a prefab, a compound collider will be created that I can reference? Do I have to create a collider for the parent GameObject?
Answer by Montraydavis · Oct 14, 2012 at 12:18 AM
Be sure that you have a Collider AND Rigidbody attached to the actual object, and not a parent/child of the object .