class MAGES::SceneGraph::GhostSelectionSync

Overview

Keeps ghosts aligned with the selected state across the local and replicated interactable states. More…

class GhostSelectionSync: public MonoBehaviour
{
public:
    // methods

    static void EnsureNetworkSelectionTracking(
        GameObject interactableObject,
        BaseActionData action,
        GhostEffectData ghostEffect
    );

    static GhostSelectionSync Attach(
        GameObject interactableObject,
        BaseActionData action,
        GhostEffectData ghostEffect,
        Action onSelectedChanged
    );

    void Initialize(Action onSelectedChanged, bool includeNetworkSelection);
};

Detailed Documentation

Keeps ghosts aligned with the selected state across the local and replicated interactable states.

Methods

static void EnsureNetworkSelectionTracking(
    GameObject interactableObject,
    BaseActionData action,
    GhostEffectData ghostEffect
)

Ensures that replicated selection state is available on the interactable when ghost sync is enabled.

Parameters:

interactableObject

The interactable object.

action

The action that owns the ghosts.

ghostEffect

The effect settings.

static GhostSelectionSync Attach(
    GameObject interactableObject,
    BaseActionData action,
    GhostEffectData ghostEffect,
    Action onSelectedChanged
)

Adds a selection sync helper to an interactable.

Parameters:

interactableObject

The interactable object.

action

The action that owns the ghosts.

ghostEffect

The effect settings.

onSelectedChanged

Callback fired when the selected state changes.

Returns:

The created sync helper.

void Initialize(Action onSelectedChanged, bool includeNetworkSelection)

Initializes the synchronization helper with the callback created for the action.

Parameters:

onSelectedChanged

The callback to invoke when the selected state changes.

includeNetworkSelection

Whether to include replicated selection state.