CharacterInitialSpawnPosition - jimdroberts/FishMMO GitHub Wiki
CharacterInitialSpawnPosition is a MonoBehaviour for FishMMO that marks a character's initial spawn position in the scene. It allows restricting spawn to specific races and draws a gizmo for visualization in the Unity editor, making it easy to identify and adjust spawn points during level design.
-
public List AllowedRaces
List of races allowed to spawn at this position.
#if UNITY_EDITOR
-
public Color GizmoColor
The color used to draw the initial spawn position gizmo in the editor. #endif
#if UNITY_EDITOR
-
void OnDrawGizmos()
Draws a gizmo at the initial spawn position for visualization in the Unity editor. #endif
- Attach the CharacterInitialSpawnPosition component to a GameObject in your scene to mark it as an initial spawn point.
- Add allowed races to the AllowedRaces list to restrict which races can spawn at this position.
- Optionally, adjust the GizmoColor field to customize the gizmo's appearance in the editor.
// Example 1: Adding an initial spawn position in the Unity Editor
// 1. Add the CharacterInitialSpawnPosition component to a GameObject.
// 2. Add allowed races to the AllowedRaces list in the inspector.
// 3. The spawn position will be visualized with a gizmo in the scene view.
// Example 2: Customizing the gizmo color
characterInitialSpawnPosition.GizmoColor = Color.blue;
- Use this component to clearly mark and visualize all initial spawn points in your scenes.
- Restrict spawn points to specific races for more controlled and immersive gameplay.
- Adjust GizmoColor to differentiate between different types of spawn points if needed.
- Document the purpose and placement of each spawn point for maintainability.