I have a Parent object with a animator so that when I enter the trigger area, the Object plays a animation, however the trigger I use is a circle collider, and in order for it to work it has to be inside the Parent object. But if its inside the parent object, I can then attack the circle collider and kill the enemy from really far away since its on the same Enemy layer.
I tried doing a child object and putting the trigger there instead, but it tells me I need to have a Animator attached to the child object…
Sorry if what I’m typing is confusing, I’m basically asking if it’s possible to have a child object trigger the Parent object’s animator to play? Or if there is another way to make triggers on the Parent Object, like gizmos?
EDIT: Okay so I just figured it out kind of… Easy solution, I just put the trigger area on the ground so my player can’t reach it with its attack. But I would still like to know if there’s a way to call stuff from the child object to play the Animation on the Parent Object’s script
Yes. You can have the trigger or collider detect the tag, object name or even a script on the child object. You could also just create another layer but that may make some things confusing later on. Then, when the collision occurs, you could have a variable like a bool get set and then check that variable on the parent object’s script to call the animation.