Question by
littleboyred1 · Dec 06, 2016 at 10:39 PM ·
errornetworkingspawnconnection
Error when using NetworkServer.SpawnWithClientAuthority()
I'm probably just doing something wrong here, but i can't figure this out. Whenever i try to spawn an object with client authority using a network connection reference, regardless of how i got the reference, be it connectionToClient used on a player spawned by a network manager, using a network manager's client.connection, or any other method i've tried, i get the following error when i run the function:
"Local invoke: Failed to find local connection to invoke handler on [connection=0] for MsgId:4"
Could anyone explain how to use this function or similar ones that require a connection? Or what i might be doing wrong?
Relevant code of one of my attempts on a network manager:
public override void OnClientConnect (NetworkConnection conn)
{
//<unrelated code>
base.OnClientConnect (conn);
connection = conn;
}
public void SpawnPlayer () {
//<unrelated code>
NetworkServer.SpawnWithClientAuthority(playerPrefab, connection)
}
Comment