SceneTeleporterDetails - jimdroberts/FishMMO GitHub Wiki
Serializable class containing details for a scene teleporter destination, including target scene, position, and rotation.
-
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.
- Ensure this class is used as a serializable field or property in a MonoBehaviour or ScriptableObject.
- Assign the
ToScene
,ToPosition
, andToRotation
values to define the teleport destination. - The
From
field is for internal use and should be set by the system managing teleporters.
// 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;
- Always set
ToScene
,ToPosition
, andToRotation
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.