- Home /
Question by
Retr0Strike · Jul 07, 2019 at 06:48 AM ·
transformpublicempty game object
Cant add scne gameobject to public property of Animator State Behaviour
I cannot put anything into the shot point transform of the Animator State Behaviour
Comment
Best Answer
Answer by Hellium · Jul 07, 2019 at 06:34 AM
You can't do this because an animator is a project asset. You can't reference scene gameObjects inside project assets.
You will need a script on the gameObject holding the animator component to pass the gameObject to the stateMachineBehaviour
public Transform ShotPoint;
private void Start()
{
Animator animator = GetComponent<Animator>();
MainGunBehaivour mainGunBehaivour = animator.GetBehaviour<MainGunBehaivour>();
mainGunBehaivour.ShotPoint = ShotPoint;
}