Skip to content

Game.Settings.GraphicsSettingsExtensions

Assembly: Assembly-CSharp
Namespace: Game.Settings

Type: static class

Base: System.Object

Summary:
Extension helpers for converting the game's GraphicsSettings cursor mode enum into Unity's CursorLockMode. Provides a single, small utility used by UI/input code to map internal cursor state to the Unity API. The method validates input and throws an ArgumentException for unsupported enum values.


Fields

  • None.
    No instance or static fields are defined on this static class.

Properties

  • None.
    There are no properties.

Constructors

  • None.
    This is a static class and declares no constructors (no static constructor is present).

Methods

  • public static UnityEngine.CursorLockMode ToUnityCursorMode(this GraphicsSettings.CursorMode mode)
    Converts a GraphicsSettings.CursorMode value into the corresponding UnityEngine.CursorLockMode. Mapping:
  • GraphicsSettings.CursorMode.Free => CursorLockMode.None
  • GraphicsSettings.CursorMode.ConfinedToWindow => CursorLockMode.Confined If an unsupported enum value is passed, the method throws an ArgumentException identifying the unsupported mode.

Exceptions: - System.ArgumentException — thrown when the provided mode value is not handled by the switch.

Remarks: - This is an extension method; call it on a GraphicsSettings.CursorMode instance (see usage). - Requires using UnityEngine; for the CursorLockMode type and the usual project references.

Usage Example

using UnityEngine;
using Game.Settings;

public class CursorModeExample
{
    public void ApplyCursorMode(GraphicsSettings.CursorMode mode)
    {
        // Calls the extension method defined in Game.Settings.GraphicsSettingsExtensions
        CursorLockMode unityMode = mode.ToUnityCursorMode();
        Cursor.lockState = unityMode;
    }
}