How do I trigger another game object’s animation/animator?
This is the reference for the other object that I want to trigger. The script below is attached to the main object, and should trigger the other object’s animation. But I keep getting console log message (Animator is not playing an AnimatorController)
public class TriggerScript : MonoBehaviour {
public GameObject otherObject;
Animator anim;
“Active”, is the name/string of the trigger from the animator of the other game object. On the inspector tab in unity, I drag and drop the other game object in the public variable. Please help
Based on the error message it’s almost certainly this.
if you have dragged the prefab into this slot you need to first Instantiate() that prefab and keep a reference to the GameObject returned from Instantiate and use that for your otherObject
In other news, I highly recommend using meaningful names, such as:
[Header( "Fill this in with the player prefab")]
public GameObject PlayerPrefab;
// assign the Instantiate-d player to this and only use this for everything at runtime
private GameObject InstantiatedPlayer;
Always seek to reduce confusion. If you use the word Object you are asking for confusion.