hey guys how do i find an specific object in the scene by script in run time
i worte this : i do know my script is not right but gives you an image anyway sorry for my English ;)
using UnityEngine;
using System.Collections;
public class OBJFinder : MonoBehaviour {
public string tower;
public GameObject[] towers;
void Start() {
towers = GameObject.FindGameObjectsWithTag("towers");
for (int i = 0; i < towers.Length; i++) {
tower = towers[i].name;
if(tower!="tower 0")
Debug.Log (string.Format ("i find {0} object for you!", tower));
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to get the Gameobject a script is attached to 2 Answers
Unity freeze when open script,I keep trying to open a script, but it freezes Unity. Please help. 1 Answer
How to make object spawn only once? 1 Answer
Take damage only when attack animation is done? 1 Answer
Can someone please help me find out what wrong with my code. 1 Answer