How does the Object Movement example populate the playerModels array?

This is a newbie question, probably “obvious” to most readers but totally baffling to me.

The SmartFoxServer2x Unity examples includes a simple one called Object Movement that spawns a cube, sphere, and capsule in multiplayer mode and lets the user change the model and the material. I was hoping to use it as a template to spawn different avatars with different clothes.

The GameManager.cs script creates an array of models, and then uses indexed members of that array as the model to instantiate.
The declaration of the array is simply:

public GameObject[ ] playerModels;

Later in the script, the index for this array is created and the program instantiates, say playerModels[2];

My problem is that there is no place in any of the scripts where this array is ever explicitly populated. The Array playerModels never occurs on the left side of an assignment statement, in ANY script.

How the heck does it realize that the only models are “cube”, “sphere”, and “capsule” and put those objects into playerModels[0], [1], and [2]?

Thank you and I apologize for not grasping what’s going on there.

You are right, the array it isnt populated in a script :slight_smile:
Instead is populated in the Inspector interface of the Game object in Editor.
Usually public variables are designated to get values in unity editor so you can tweak them until you find the right value. Or in your case populate an array with prefabs.