Simple getComponent problem in C#! help!

i have a simple problem for someone thats more familliar with C# , i have a 2d game and have a game object with an AI script. theres a child of that gameobject that is a sprite mesh and has its own script to play animations. i need to call on it to play the animations waht i need is something like this.

Sprite = GetComponent(“EnemyAnimator”); = true;

how do i pull this off in C#~!?



EnemyAnimator Sprite = (EnemyAnimator)GetComponentInChildren<EnemyAnimator>(); // this will search for an EnemyAnimator script parented to the gameObject this script is attached = true;