Network Spawn Utilities

This class provides helper methods for creating and managing objects on the network.

Methods

  1. public static GameObject SpawnObject(GameObject obj,
    Vector3 position = default,
    Quaternion rotation = default)
    • Parameters:

      • obj: The object to be created.

      • position (default value: default): Position of the created object.

      • rotation (default value: default): Rotation of the created object.

    • If the network manager is not present, it warns and returns null. Otherwise it creates the object, shares it on the network, and returns the created object.

  2. public static GameObject SpawnObjectForScene(Scene scene,
    GameObject obj,
    Vector3 position = default,
    Quaternion rotation = default)
    • Parameters:

      • scene: The scene where the object should be added.

      • obj: The object to be created.

      • position (default value: default): Position of the created object.

      • rotation (default value: default): Rotation of the created object.

    • If the network manager is not present, it warns and returns null. Otherwise it adds the object to the specified scene and returns the object.

  3. public static IEnumerable<GameObject> GetSpawnablePrefabs()
    • Returns a list of spawnable objects to be loaded from resources.

Last updated