- Home /
Problem is not reproducible or outdated
SpawnWithClientAuthority issues
Okay,
playerCamera = (GameObject)Instantiate(playerCamera, transform.position + cameraOffset, cameraRotation);
NetworkServer.SpawnWithClientAuthority(playerCamera, this.gameObject);
This is the code I'm using to spawn cameras for each of my players.
My camera is a network spawnable prefab. It's spawned as part of the player because it's a free floating follow camera not designed to be parented to anything.
Whenever I have "Local Player Authority" checked on the NetworkIdentity checkbox, it doesn't actually give ownership, and as such the camera will never actually turn on.
However if I uncheck Local Player authority, ownership transfers, but it doesn't work right. Every player will use the camera of the last player to join.
if (hasAuthority)
{
cam.enabled = true;
mic.enabled = true;
}
This should only apply to the camera that the player has authority over. However it seems that the last player to join is turning on that camera for everyone.
Been trying to figure this out for too long and it's getting quite frustrating.
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Unity Networking Client not calling functions on server 0 Answers
Can a person be both a client and a server? (and more) 0 Answers
How do you Change Color or any variable of non-player object on both client and server in uNet 0 Answers
Multiplayer advanced - Single Player in Multiplayer game, using another Hosting services. 0 Answers