void GetMediaObjects() { string image = "Image"; GameObject[] imageObjects = GameObject.FindGameObjectsWithTag(image); if (imageObjects.Length > 0) { images = new ImageController[imageObjects.Length]; foreach (GameObject obj in imageObjects) { // Extract index from image name int index = int.Parse(obj.name.Substring(image.Length)); images[index] = obj.GetComponent <ImageController>(); Debug.Log(images[index].name + " : " + obj.name); } } string sound = "Sound"; GameObject[] soundObjects = GameObject.FindGameObjectsWithTag(sound); if (soundObjects.Length > 0) { sounds = new AudioController[soundObjects.Length]; foreach (GameObject obj in soundObjects) { // Extract index from sound name int index = int.Parse(obj.name.Substring(sound.Length)); sounds[index] = obj.GetComponent <AudioController>(); Debug.Log(sounds[index].name + " : " + obj.name); } } string clue = "Clue"; GameObject[] clueObjects = GameObject.FindGameObjectsWithTag(clue); if (clueObjects.Length > 0) { clues = new ClueController[clueObjects.Length]; foreach (GameObject obj in clueObjects) { // Extract index from sound name int index = int.Parse(obj.name.Substring(clue.Length)); clues[index] = obj.GetComponent <ClueController>(); Debug.Log(clues[index].name + " : " + obj.name); } } string inputPanelString = "InputPanel"; GameObject inputP = GameObject.FindGameObjectWithTag(inputPanelString); if (inputP != null) { inputPanel = inputP.GetComponent <InputZoneController>(); } }
private void Start() { originalSize = rectTransform.sizeDelta; myInputZoneParent = GetComponentInParent <InputZoneController>(); }