I’m pretty new to Unity and I’ve been trying to debug a question for hours.
I created a “player” prefab in editor and assigned it a rigidbody. I then attached a “weapon” prefab in a script and added it as a child to “player”. I then created a “bullet” object in script, also rigidbody in the manner of the fps tutorial. I want to make sure the bullet doesn’t collide with the player. However, when I try to 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.”
I’ve been looking for hours to see what I could’ve done wrong. From my understanding, a rigidbody would have a collider object right? All the child objects of my prefab have collider objects. I assumed there would be a compound collider on the rigidbody created that would catch collisions. Do I have to create some sort of an object on the player? Any help would be greatly appreciated!