- Home /
Which is faster, referencing a static method or using GetComponent(script)
Hi everyone, which is faster to run on iOS? Sorry if this has been asked before, but I couldn't find it anywhere.
It's more an issue of what you want to do with it, not so much speed.
Answer by Bunny83 · Apr 06, 2011 at 02:16 PM
Calling a static method is of course faster than calling GetComponet, but that are two different things. Static methods doesn't belong to a class instance. If you work object oriented you normally work with object instances. To speed things up you should cache the references at Start whenever it's possible. Calling a method of a script instance is almost the same speed as calling a static method.
Your answer
Follow this Question
Related Questions
HUD with a lot of elements, efficient way? 3 Answers
Are there any performance differences between a timer and using Invoke? 1 Answer
Android lag 1 Answer
Reasonable heap alloc. per second and total ? 0 Answers
Aggro and unit collision 2 Answers