- Home /
Whats the best workaround for finding Gameobjects at Start?
Hi,
i would like to know whats the best workflow how to handle a large amount of finding Gameobjects at the start of a scene? In my current project i have up to 15 private gameobjects varibles which are defined in a Awake()-function like
private go : Gameobject;
function Awake(){
go = GameObject.Find("monster") as Gameobject;
// and thats with all my different Gameobjects i need to have
}
It would be interesting whats the best practice for that? How do you that for example in a complex game? Is it better to work with tags, or making the gameobject varible public which are already known and then assign it to a component before startup? Whats the best for performance?
Any tips/ hints on that. Would be great to know, thanks for your time... yosh
Answer by StephanK · May 18, 2010 at 07:35 AM
Best runtime performance would probably be if you assign the gameObjects manually from the editor. (using public variables) But that would probably be a pita so the next best thing would be having a tag named "monster" for your monsters and do GameObject.FindGameObjectsWithTag("monster").
Your answer
Follow this Question
Related Questions
Which is faster, GameObject.Find or GameObject.FindWIthTag? 2 Answers
Does inactive Objects eat up Performance? 1 Answer
large number of identical objects in scene? 3 Answers
Replace GameObject vs. replacing mesh and material? 2 Answers
Need to select whatever object is at a certain position 2 Answers