ParaObjectService.NetSpawn

Declaration

public static GameObject NetSpawn(string key, out ref id)

public static GameObject NetSpawn(string key, Vector3 position, out ref id)

public static GameObject NetSpawn(string key, Vector3 position, Quaternion rotation, out ref id)

Parameter

Parameter NameParameter Description
keyThe keyword of the object to be spawned. This object needs to be registered in ParaWorldRoot.NetSpawnObjects.
positionThe initial position of the object to be spawned.
rotationThe initial orientation of the object to be spawned.

Description

Returns the network object spawned via the specified keyword, and the unique ID of the object. The ownership of the spawned network object belongs to the player who calls this method.
The ownership of a network object always belongs to a certain player. When the owner of an object spawned through NetSpawn leaves a room, the ownership of the object will be automatically transferred to the room master. Generated objects will not be automatically destroyed. To destroy a generated object, players need to call NetDestroy to destroy its logic.

function SpawnNetObject(key, pos, rotate)
  local gameObject, uniqueId = CS.ParaObjectService.NetSpawn(key, pos, rotate)
  return gameObject
end