public static bool SpawnWithClientAuthority(GameObject obj, Guid assetId, NetworkConnection conn) { Spawn(obj, assetId); NetworkIdentity identity = obj.GetComponent<NetworkIdentity>(); if (identity == null || !identity.isServer) { // spawning the object failed. return false; } return identity.AssignClientAuthority(conn); }
public static bool SpawnWithClientAuthority(GameObject obj, NetworkConnection conn) { if (!conn.isReady) { Debug.LogError("SpawnWithClientAuthority NetworkConnection is not ready!"); return false; } Spawn(obj); NetworkIdentity identity = obj.GetComponent<NetworkIdentity>(); if (identity == null || !identity.isServer) { // spawning the object failed. return false; } return identity.AssignClientAuthority(conn); }