Skip to content
Snippets Groups Projects
ArrowSpawner.cs 518 B
Newer Older
  • Learn to ignore specific revisions
  • using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class ArrowSpawner : StateMachineBehaviour
    {
        [SerializeField] GameObject arrowPrefab;
        GameObject arrow;
    
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            if (stateInfo.IsName("shoot"))
            {
                Debug.Log("Spawn Arrow");
                arrow = Instantiate(arrowPrefab,animator.gameObject.transform.position,Quaternion.identity);
            }
        }
    }