Tuesday, August 9, 2022
HomeGame Developmentunity - I've set my animation to play when the participant enters...

unity – I’ve set my animation to play when the participant enters a set space a by script nevertheless it’s not enjoying


I’ve set my animation to play by a script I made nevertheless it’s not enjoying. I’ve all of the references right my spelling is right as properly.
My code:

utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;

public class AnimationTrigger : MonoBehaviour
{
    [SerializeField] non-public Animator myDoor;
    [SerializeField] non-public string DoorOpen = "DoorOpen";

    non-public void OnTriggerEnter(Collider different)
    {
        if(different.CompareTag("Participant"))
        {
            myDoor.Play(DoorOpen, 0, 0.0f);
            Debug.Log("Animation Performed");
        }
    }
    
}


Image of my animator window:

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments