Answer the question
In order to leave comments, you need to log in
How to access a character with a script from another object?
There is a simple character animation control script. But it works when the script is attached to the character.
How to rewrite the code so that the script hangs on a neutral object? For example on the surface.
public class Manage_grl1 : MonoBehaviour
{
Animator _animator_grl1;
void Start()
{
_animator_grl1 = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.L))
{
KeyL();
}
}
public void KeyL()
{
Debug.Log("Нажали L");
_animator_grl1.SetBool("startwrestle_grl1", true);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question