RegionChangeSkyboxAction - jimdroberts/FishMMO GitHub Wiki

Description

RegionChangeSkyboxAction is a region action ScriptableObject for FishMMO that changes the skybox material for the owning client when triggered. It is used to dynamically alter the visual environment of a region by setting a specified skybox material, enhancing immersion and atmosphere for players entering or interacting with the region.


API Access

Fields

  • public Material Material

    The skybox material to set when this region action is triggered.

Methods

  • public override void Invoke(IPlayerCharacter character, Region region, bool isReconciling)

    Sets the skybox material for the owning client if the action is triggered and not during reconciliation. Parameters: - IPlayerCharacter character: The player character triggering the action. - Region region: The region in which the action is triggered. - bool isReconciling: Indicates if the action is part of a reconciliation process.


Basic Usage

Setup

  1. Ensure a Material asset is available in your project to use as a skybox.
  2. Create a new RegionChangeSkyboxAction ScriptableObject via the Unity Editor (Assets > Create > FishMMO > Region > Region Change Skybox).
  3. Assign the desired skybox Material to the Material field in the inspector.
  4. Attach the RegionChangeSkyboxAction to a region definition or trigger as needed.

Example

// Example 1: Assigning a skybox material to a region action
// 1. Create a new RegionChangeSkyboxAction asset in the Unity Editor.
// 2. Assign a skybox Material to the Material field in the inspector.
// 3. Reference this asset in your region setup.

// Example 2: Triggering the action in code
// This is typically handled by the region system, but can be invoked manually for testing.
regionChangeSkyboxAction.Invoke(playerCharacter, region, false);

Best Practices

  • Always assign a valid Material to avoid null reference issues.
  • Use unique skybox materials for different regions to enhance visual variety.
  • Avoid triggering this action during reconciliation or for non-owning clients to prevent unintended visual changes.
⚠️ **GitHub.com Fallback** ⚠️