I\'m working on and learning some basics of Unity 5, UNET, and networking. I made a simple 3D game where you go around and change the colors of objects. But I want to make i
Rather than using "Assign Object Authority",
I really recommend simply using
.SpawnWithClientAuthority
It's really very easy.
In fact it's this simple!
[Command]
void CmdPleaseSpawnSomething() {
GameObject p = Instantiate(some_Prefab);
NetworkServer.SpawnWithClientAuthority(p, connectionToClient);
}
{In that code, note that "connectionToClient" is magically available with no effort - it means "the client" who called this command.}
On the client (the one you want to "own" the thing), just call CmdPleaseSpawnSomething()
.
I mean - that's all there is to it, thank goodness.
There's a long clear explanation here:
https://forum.unity.com/threads/assign-authority-to-local-client-gameobject.371113/#post-3592541