Hello Everyone.Below is my code.I want to access each elememt of the the array GameObject screens.Can anyone help me with it. Thanks
using UnityEngine;
using System.Collections;
public class Screens : MonoBehaviour {
public GameObject[] screens;
public GameObject arcamera;
public GameObject textrecognition;
public GameObject screen1;
private UIRoot uiroot;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void Assignment(){
arcamera.gameObject.SetActive(false);
textrecognition.gameObject.SetActive(false);
screen1.gameObject.SetActive(true);
Debug.Log("text is false");
}
}
I tried this
for(var i = 0; i < screens.Length; i++)
{
var item = screens[0];
item.gameObject.SetActive(true);
}
This did not work