- Home /
 
 
               Question by 
               FPSworrior · Dec 11, 2018 at 05:15 AM · 
                animationarraytrigger  
              
 
              Help with array with animators.
So I'm trying to make a script that I can use when entering a trigger, then the animators in one array play a animations in another array respectively. So I enter the trigger and animator[0] player animation defined by a string[0], then animator[1] plays animation[1] and so on. I'm just not sure how to get this system to work, any help would be appreciated.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class TriggerAnimation : MonoBehaviour {
 
     public GameObject[] anims;
     public string[] animationToPlay;
     private bool trigger;
     // Use this for initialization
     void Start () {
     }
     
     // Update is called once per frame
     void Update () {
 
         if (trigger == true)
         {
             for (int i = 0; i < anims.Length; i++)
             {
                 
             }
         }
     }
 
     private void OnTriggerEnter(Collider other)
     {
         trigger = true;
     }
 }
 
 
              
               Comment
              
 
               
              Answer by KevinSSH · Dec 11, 2018 at 11:49 AM
Your first member is GameObject[] which you should use Animator[] instead.
Your answer