Support Forum

Pathfinding scripts on Child

My AI object is starting to have too many components attatched. If I move the pathfinding components to a child of the AI only the child moves. Is there a way to tell the pathfinding component to move the parent of the gameObject it is attatched to, instead of just moving the gameObject?

Edit: I’m using RigidBody2D and the default AIPath script. Do I need to have them in the same gameObject?
I know it would be better to make my own Movement Script but I haven’t any examples using RigidBodies and I wasn’t able to do it by myself.

Hi

Yes, the component the AIPath script is attached to will always be the one to move. And thus the rigidbody will also need to be attached to the same object.