Unity-Technologies / com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.15k stars 435 forks source link

[Question] How to ChangeOwnerShip before spawning object on server? #107

Closed FireDragonGameStudio closed 6 years ago

FireDragonGameStudio commented 6 years ago

Hy, I spotted a small mistake in the documentation, regarding Ownership.

Code

This is wrong in the documentation, as ChangeOwnership is void and can't be assigned to anything.

NetworkedObject myNetObject = GetComponent<NetworkedObject>().ChangeOwnership(clientId);

Your Environment

Best regards :)

TwoTenPvP commented 6 years ago

I resolved the wiki issue: https://github.com/MidLevel/MLAPI/wiki/Object-Ownership

As for how to set the ownership before spawning, use the SpawnWithOwnership call instead of Spawn.

FireDragonGameStudio commented 6 years ago

Thx, I'll close this for now and sorry for the confusing title. Just realized, that the text in the clipboard was wrong (mixed up my notes and question documents).