Je fais un jeu avec l'unité avec le réseau RPC et je veux lancer le joueur dans des coordonnées spécifiques. Voici le nouveau code de spawn du joueur: `instancier les coordonnées C#
[RPC]
void JoinPlayer(NetworkViewID newPlayerView, Vector3 pos, NetworkPlayer p)
{
// instantiate the prefab
// and set some of its properties
GameObject newPlayer = Instantiate(playerPrefab, pos, Quaternion.identity) as GameObject;
newPlayer.GetComponent<NetworkView>().viewID = newPlayerView;
newPlayer.tag = "Player";
// set the remote player's target to its current location
// so that non-moving remote player don't move to the origin
newPlayer.GetComponent<playerController>().target = pos;
// most importantly, populate the NetworkPlayer
// structure with the data received from the player
// this will allow us to ignore updates from ourself
newPlayer.GetComponent<playerController>().netPlayer = p;
// the local GameObject for any player is unknown to
// the server, so it can only send updates for NetworkPlayer
// IDs - which we need to translate to a player's local
// GameObject representation
// to do this, we will add the player to the "players" Hashtable
// for fast reverse-lookups for player updates
// Hashtable structure is NetworkPlayer --> GameObject
players.Add(p,newPlayer);
`
Alors, comment puis-je lancer un joueur dans des coordonnées spécifiques?
D'accord, je suis juste un begginer, alors comment exactement mon code ressemblerait? Disons que les coordonnées sont 505, 7, 369 –
@ NedasVišniauskas J'ai édité ma réponse. – Joetjah