SceneTeleporterDetails - jimdroberts/FishMMO GitHub Wiki

Description

Serializable class containing details for a scene teleporter destination, including target scene, position, and rotation.


API Access

Fields

  • internal string From

    The source teleporter name (internal use).

  • public string ToScene

    The name of the scene to teleport to.

  • public Vector3 ToPosition

    The position in the target scene where the character will be teleported.

  • public Quaternion ToRotation

    The rotation to apply to the character at the teleport destination.


Basic Usage

Setup

  1. Ensure this class is used as a serializable field or property in a MonoBehaviour or ScriptableObject.
  2. Assign the ToScene, ToPosition, and ToRotation values to define the teleport destination.
  3. The From field is for internal use and should be set by the system managing teleporters.

Example

// Example 1: Defining a teleporter destination
SceneTeleporterDetails details = new SceneTeleporterDetails {
    ToScene = "Dungeon01",
    ToPosition = new Vector3(10, 0, 5),
    ToRotation = Quaternion.identity
};

// Example 2: Using SceneTeleporterDetails in a MonoBehaviour
[SerializeField]
private SceneTeleporterDetails teleporterDetails;

Best Practices

  • Always set ToScene, ToPosition, and ToRotation to valid values before teleporting a character.
  • Use the From field only for internal tracking or system logic.
  • Mark the class as [Serializable] to allow Unity to serialize it in the Inspector or ScriptableObjects.
⚠️ **GitHub.com Fallback** ⚠️