Recommendations on how to load characters...

My google-fu is weak on this topic. I searched for a while and wasn’t able to find anything. Possibly because I’m searching for the wrong terms.

I have a scene that I want to load the player’s characters on to. The scene has a loading “zone” or area where the characters can be loaded.

My first thought was to place a plane on the scene that would be the “loading” plane. Loop through the characters and place them on that plane. However, I haven’t been able to figure out how to get the dimensions of the plane in Javascript.

Am I going about this the right way?

I have made this a “new” answer, as the comment is hidden under the “show more replies”. I thought Answers had failed to save it as I missed the tiny button for “show more replies”, so I wrote it twice.

Well, we’re even then! (^_^)!

I guess what I’m saying is that you don’t need to know the dimensions of the plane. To get an area (your spawn zone) you need to know a point and the dimensions or area around it. What I’m saying is you don’t need the plane. Replace the plane with a point. You need a point (GameObject Transform) - and then an x (float) value for a square or an x,z (Vector2) value for a rectangle.

You could find the bounds of the mesh you are using. Look up BOUNDS in the docs. But if you read the description, you can see that bounds is made up of its center and extents, or alternatively by min and max points. This is what you get by using the Spawn Point game object and a value, and you will have more control over that in the inspector than by manipulating a plane.

If you need to see a plane in the scene view for reference purposes, you can use a plane attached to your spawn point, but you will need to find a way to remove/deactivate your plane at run time (see above):
alt text

If it were me I would use Gizmos:
alt text

The quick back-pocket code for the gizmos is here:

 @script ExecuteInEditMode()
    
    var spawnArea : float;
    
    private var frontLeft : Vector3;
    private var frontRight : Vector3;
    private var backLeft : Vector3;
    private var backRight : Vector3;
    
    function Start () {
    	spawnRadius = spawnArea / 2;
    }

    function Update () {
    	frontLeft = Vector3 (transform.position.x + spawnRadius, transform.position.y, transform.position.z + -spawnRadius);
    	frontRight = Vector3 (transform.position.x + spawnRadius, transform.position.y, transform.position.z + spawnRadius);
    	backLeft = Vector3 (transform.position.x + -spawnRadius, transform.position.y, transform.position.z + -spawnRadius);
    	backRight = Vector3 (transform.position.x + -spawnRadius, transform.position.y, transform.position.z + spawnRadius);
    }
    
    function OnDrawGizmos () {
    	Gizmos.color = Color.red;
    	Gizmos.DrawLine(frontLeft, frontRight);
    	Gizmos.DrawLine(frontRight, backRight);
    	Gizmos.DrawLine(backRight, backLeft);
    	Gizmos.DrawLine(backLeft, frontLeft);
    	
    	Gizmos.DrawIcon (transform.position, "SpawnPoint.psd", true);
    }

So - yes, you could use a plane and get the bounds on the mesh, but you could be tying your hands when it comes to the versatility of creating an area and maintaining it in the inspector.

I would def. search on this one. It has been answered a number of times.
Try here for a google custom search engine for everything Unity:
Looking for Answers? Use the Google Custom Search Engine!

TBH, I’m a little unclear what you are asking about. Is this a multi-player game? And why are you loading characters at runtime?

If you want to “spawn” characters, I would create a “Spawn Point” for them.

Read up on Instantiate in the docs and notice that you need an object, vector3 and quaternion to instantiate something - or what you want to instantiate, where you want to instantiate it and lastly, what the rotation for that object will be. A GameObject’s Transform Component will have the Vector3 as Position and the Quaternion as Rotation, so you can create a “Spawn Point” using an empty GameObject and you can reference that with a variable of type Transform:

var mySpawnPoint : Transform; // JS
public Transform mySpawnPoint; // C#

You could then create a number of spawn points, save them in a list or array and pick one at random, or, if it works for your game, take that one spawn point and then add a random value to the position so when you instantiate your character it will be “near” that spawn point:

spawnPosition : Vector3 = Vector3 (mySpawnPoint.x + Random.Range (-1, 1), mySpawnPoint.y, mySpawnPoint.z + Random.Range (-1, 1));

You will need to be more clever than that to prevent multiple spawns from potentially overlapping.