Efficiency of Game Loops

What is the difference between letting the objects run their own update functions during run time, versus, using a Game Manager to call their "update" functions during run time? Is there any efficiency cost of using a GameManager Class to run the game rather than just using the default component based system that Unity provides?

==========================================================================

Example of Component Based:

Script1:

function Update() { // Run Object 1's Update stuff; }

Script2:

function Update() { // Run Object 2's Update stuff; }

And so on...

==========================================================================

Example of Using a Game Manager:

public class GameManager : MonoBehaviour {

// Update Function for the Game Manager Class

void Update()
{
    // Check for Input and Assign values to Player

    // Update Player

    // Update Environment

    // Update so on...
}

}

===========================================================================

Feedback would be greatly appreciated... Thank you (:

If you mean looping through all objects in a single Update function as opposed to having each object use its own Update function, then yes, there is overhead involved in an Update call that you can eliminate by consolidating them.

However, it's questionable whether you would call this "improved efficiency". It's likely your code will become more complicated, for one, which means more chance for bugs. It's possible you're not CPU-limited in the first place, or that the Update calls are contributing a small enough amount that "fixing" this won't actually improve the framerate at all. Also, it's possible that you're better off not using Update in the first place anyway, and would find coroutines or other methods like InvokeRepeating more effective.

A central game manager, in my opinion should only be used in specific circumstances.

Imagine a variable ‘x’ from a script ‘Script’. If x is used in an update of Script :

Use → x;

If you use a central manager to do this :

Retrieve x from ‘Script’;
Use → x;

Which is essentially ‘twice’ the operation. If you do this for a large amount of stuff you would impact performance.

Use GetComponent over gameObject.find but minimise usage of both, and if possible restrict it to use in the start() functions.