Hey. I want to start a coroutine over a list of gameobject which looks like this:
using UnityEngine;
using System.Collections;
using System.Linq;
public class AnimateSlots : MonoBehaviour {
public GameObject[] m_Slots;
public float delay;
// Use this for initialization
void Start () {
}
private void Update ()
{
GameObject[] m_TargetsGO = GameObject.FindGameObjectsWithTag("Slots").OrderBy( go => go.name ).ToArray();
m_Slots = new GameObject[m_TargetsGO.Length];
for(int i = 0; i < m_TargetsGO.Length; ++i)
{
m_Slots <em>= m_TargetsGO*;*</em>
* }*
* }*
* public void OnButtonClickedEvent ()*
* {*
* StartCoroutine(ActivateAnimation(0.2f));*
* }*
* IEnumerator ActivateAnimation(float delay)*
* {*
* for(int i = 0; i < m_Slots.Length; i++);
_ {_
m_Slots.GetComponent.Play(“slot_open”);*
* //You can adjust the dealy whn calling the coroutine*
* yield return new WaitForSeconds(delay);*
* }*
* }*
}
but i get the error:
error CS1061: Type UnityEngine.GameObject[]' does not contain a definition for
GetComponent’ and no extension method GetComponent' of type
UnityEngine.GameObject[]’ could be found (are you missing a using directive or an assembly reference?)
what did i wrong?