This commit is contained in:
vis2k 2021-03-07 14:55:55 +08:00
parent f3b7524691
commit 93217b4493

View File

@ -1179,13 +1179,8 @@ public static void Spawn(GameObject obj, GameObject ownerPlayer)
Spawn(obj, identity.connectionToClient); Spawn(obj, identity.connectionToClient);
} }
/// <summary> /// <summary>Spawns an object and also assigns Client Authority to the specified client.</summary>
/// This spawns an object like NetworkServer.Spawn() but also assigns Client Authority to the specified client. // This is the same as calling NetworkIdentity.AssignClientAuthority on the spawned object.
/// <para>This is the same as calling NetworkIdentity.AssignClientAuthority on the spawned object.</para>
/// </summary>
/// <param name="obj">The object to spawn.</param>
/// <param name="assetId">The assetId of the object to spawn. Used for custom spawn handlers.</param>
/// <param name="ownerConnection">The connection that has authority over the object</param>
public static void Spawn(GameObject obj, Guid assetId, NetworkConnection ownerConnection = null) public static void Spawn(GameObject obj, Guid assetId, NetworkConnection ownerConnection = null)
{ {
if (VerifyCanSpawn(obj)) if (VerifyCanSpawn(obj))
@ -1257,19 +1252,19 @@ static void DestroyObject(GameObject obj, bool destroyServerObject)
} }
} }
/// <summary> /// <summary>Destroys this object and corresponding objects on all clients.</summary>
/// Destroys this object and corresponding objects on all clients. // In some cases it is useful to remove an object but not delete it on
/// <para>In some cases it is useful to remove an object but not delete it on the server. For that, use NetworkServer.UnSpawn() instead of NetworkServer.Destroy().</para> // the server. For that, use NetworkServer.UnSpawn() instead of
/// </summary> // NetworkServer.Destroy().
/// <param name="obj">Game object to destroy.</param>
public static void Destroy(GameObject obj) => DestroyObject(obj, true); public static void Destroy(GameObject obj) => DestroyObject(obj, true);
/// <summary> /// <summary>This takes an object that has been spawned and un-spawns it.</summary>
/// This takes an object that has been spawned and un-spawns it. // The object will be removed from clients that it was spawned on, or
/// <para>The object will be removed from clients that it was spawned on, or the custom spawn handler function on the client will be called for the object.</para> // the custom spawn handler function on the client will be called for
/// <para>Unlike when calling NetworkServer.Destroy(), on the server the object will NOT be destroyed. This allows the server to re-use the object, even spawn it again later.</para> // the object.
/// </summary> // Unlike when calling NetworkServer.Destroy(), on the server the object
/// <param name="obj">The spawned object to be unspawned.</param> // will NOT be destroyed. This allows the server to re-use the object,
// even spawn it again later.
public static void UnSpawn(GameObject obj) => DestroyObject(obj, false); public static void UnSpawn(GameObject obj) => DestroyObject(obj, false);
internal static bool ValidateSceneObject(NetworkIdentity identity) internal static bool ValidateSceneObject(NetworkIdentity identity)