SFS2x and unity spawnpoints based on number of connected players

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

katherineamt
Posts: 1
Joined: 12 Nov 2018, 14:07
Location: USA
Contact:

SFS2x and unity spawnpoints based on number of connected players

Postby katherineamt » 12 Nov 2018, 14:26

I would like to know how to get the current number of players in a room and then use this as the spawn point for when a player joins the game in a simple Unity game. I had some idea but dont really know which way to go to get the data I need. Right now I using the simple objectmovement tutorial. Right now I am playing around in the spawn local player method to tell where the player should spawn to. I dont know what to call or how to call it from the SFS2x server to get the user count.

So here is where I am messing around with the code:

Code: Select all

 if (localPlayer != null) {
             pos = localPlayer.transform.position;
             rot = localPlayer.transform.rotation;
             Camera.main.transform.parent = null;
             Destroy(localPlayer);
         } else {
             
             pos = sp[0];
             Debug.Log(sp[0]);
             rot = Quaternion.identity;
         }

While my reserch I found this question, I need full clarity on this, help me with good explanation.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFS2x and unity spawnpoints based on number of connected players

Postby Lapo » 12 Nov 2018, 15:26

This is a photocopy of an existing post submitted 5 years ago:
viewtopic.php?t=15797

Why did you copy the same text?
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 48 guests