- Home /
Duplicate Question
Whats more efficient for unity?
Is it smarter to make one large script with all of the things needed to be updated in one update function, or to have many update functions and multiple scripts for different things.
Is there any other things I could do to polish my game and reduce lag?
Answer by Kiwasi · Dec 02, 2014 at 06:02 PM
Smaller is better. Each script should do one job and one job only. It also means code can be reused effectively.
Your best bet for improving frame rate is to profile. Then you can eliminate the actual bottle necks.
If you don't want to pay for pro then it becomes a guessing game. As a general rule you should try simplifying graphics, more efficient algorithms and moving code out of Update. But this could be totally wrong advice for your specific project. Performance bottlenecks turn up in all sorts of weird places.
Answer by Ardivaba · Dec 02, 2014 at 05:09 PM
This doesn't matter. While in theory it might be more efficent to have just one function and one script for everything...but microseconds that you save from that isn't worth it.
Your fps issue lies in somewhere else.
Answer by YoungDeveloper · Dec 02, 2014 at 05:11 PM
Memory usage and allocation is what you should you be worrying about. Do what's best for maintenance and modularity.
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Queuing Gameobjects 0 Answers
Does scale make a difference? 2 Answers