Helloz…
I have a question about Optimisation / Performance for mobile device…
I have alot of prefabs being instantiated into the game, (for mobile, its not ideal… i know)
In the game, i have an Empty game object that has a script that holds many FUNCTIONS…
Being a prefab, i cannot CACHE anything that is IN the game…into a variable via the editor
Id like the prefabs to locate that empty gameObject… and call on the function
Ive tried:
- GameObject.Find that
object…GetComponent(Script)… and
then Script.Function(). - GameObject.Find… and Send Message
- GameObjectFindByTag (apparently
faster) - Find it via a static
variable: Script.StaticVariable.Function() - Hierarchy it to a parent…
Transform.parent.GetComponent(Script).Function
Hope im making sense >.<
Would like to ask what is the fastest method for an Instanced Prefab to call upon a function being held by an Empty Game Object.
And if it theres other methods than the ones i have listed, then i dont know them
And would like your wisdom!!
Thanks!!
Gah... its like the method that i used the least >.< But if a method has a name to it..(singleton design), must be pretty good then. Ill start replacing everything with that then. Thanks heaps Chronos! Now you have me looking up more "named" methods :P
– ArmarageXJust to be careful, you should do some research, look at some references before you make the modifications. I used singleton-design in AudioManagement (SFX and stuff), GameManagement(Play-pause-loadlevel), and sometimes GUI(A centralized GUI script)
– Chronos-L