|
There are many ways to access other game objects in unity. I think using tag is the easiest way for me because I dont need to pay attention to the object's hierarchy. But it may take cost compared to other ways. http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html Could you tell me your opinion about this?
(comments are locked)
|
|
Well i have used several ways to access Game Objects and it depends on the situation there is no better way of doing it. Tags access the whole game object/s and Get Component accesses a script/component from a certain Game Object.
(comments are locked)
|
|
If you consider object lookup performance in runtime then using fixed referenced object in inspector is the best choice .In that case unity has early bound reference to the object which does not suffer from enumeration cost. For that reason, using GameObject.find(...) in Update() is worst way to go.
(comments are locked)
|

sorry to be a stickler, this is more a question and answer place than a forum, best to stick this discussion thread on the forum :)
As for what this is talking about, you just use objects as the 'pointer' to them
Tags can be slow, but you can use them if there's only one object you need to get at a time. Otherwise, just do it the usual programming way- keep references to all the objects you want to have access to, and pass them around in code. That's the fastest way (much better than using string lookups, which is what tags are).