API

Assembly: Spark.Triggers Interface: ITriggersPlugin Implementation: TriggersPlugin

Interface

public interface ITriggersPlugin
{
    void ExecuteTrigger(TriggerEntry triggerEntry,
        TriggerExecutionContext context);
    void ExecuteTriggers(List<TriggerEntry> triggerEntries,
        TriggerExecutionContext context);
    void ExecuteTriggerInstance(TriggerInstance triggerInstance,
        TriggerExecutionContext context);
    void ExecuteTriggerInstances(List<TriggerInstance> triggerInstances,
        TriggerExecutionContext context);
    void ExecuteTriggersWithDelay(List<TriggerEntry> triggerEntries,
        TriggerExecutionContext context, float delay);
    void RegisterTriggerEntity(TriggerEntity entity);
    void UnregisterTriggerEntity(TriggerEntity entity);
}

TriggerEntry

Extends SparkDatabaseEntry. Defines a configurable action.

Field
Type
Description

triggerType

TriggerTypeBase

The trigger definition script

triggerTypeData

TriggerDataAsset

Nested configuration data

executionDelay

float

Delay before execution (0-10 seconds)

allowMultipleExecutions

bool

If false, fires only once per entity

Methods:

TriggerInstance

Wraps a TriggerEntry with optional delay overrides. Used in lists where each trigger may have a custom delay.

Field
Type
Description

template

TriggerEntry

Reference to the trigger entry

overrideDelay

bool

Override the entry's delay

customDelay

float

Custom delay value (0-10)

Methods:

TriggerExecutionContext

Carries data for trigger execution.

Property
Type
Description

Source

GameObject

Entity executing the trigger

Target

GameObject

Target of the trigger

Position

Vector3

World position

TriggerEntry

TriggerEntry

The trigger being executed

TriggerInstance

TriggerInstance

Instance data (if applicable)

AdditionalData

object

Arbitrary extra data

EventName

string

Associated event name

EventValue

float

Associated numeric value

Builder Methods:

Accessor Methods:

TriggerTypeBase

Abstract ScriptableObject base for trigger implementations.

TriggerDataAsset

Abstract base for trigger-specific configuration. Extends SparkDatabaseEntryNestedData.

TriggerEntity

MonoBehaviour that tracks one-shot trigger execution state.

Methods:

Commands

Command
Fields
Description

ExecuteTriggerCommand

TriggerEntry, TriggerExecutionContext

Executes a trigger through the network

Creating Custom Triggers

Usage

Last updated

Was this helpful?