- Home /
Question by
ClausKleber · Aug 17, 2015 at 08:15 PM ·
c#networkingmultiplayer
Tell the NetworkManager to spawn individual playerPrefab from Client
Hello,
i am trying to set the playerPrefab from a client before the NetworkManager is spawning it. In this way the client has the possibility to change the playerPrefab before he is joining the game. But i cannot find a way to tell the server which prefab should be used.
I've tried to do a RPC request before OnServerAddPlayer(...) spawnes the prefab but the RpcRequestPrefab() function only runs on server side.
public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
{
playerPrefab = RpcRequestPrefab();
base.OnServerAddPlayer (conn, playerControllerId);
}
[ClientRpc]
public GameObject RpcRequestPrefab()
{
return character;
}
What is the right way to get the playerPrefab from client so that the server is able to spawn it?
Thanks a lot!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612000230im_/https://answers.unity.com/themes/thub/images/avi.jpg)