Available in the Gaming / Industries Circle
quantum | v2 switch to v1  

Collider Custom Assets

Overview

The goal of using custom assets to define behavior is to have a single shared implementation for dynamic and static triggers. Trigger Enter & Exit callbacks are detected in the TriggerSystem which then finds the relevant asset and processes its behavior.

Back To Top
 

TriggerBehavior

The TriggerBehavior is an abstract base class which is inherited from by the concrete implementations such as SpeedChange and GadgetPickup.

public unsafe abstract partial class TriggerBehavior
{
    public virtual void OnDynamicEnter(Frame frame, EntityRef entity, EntityRef otherEntity) { }
    public virtual void OnDynamicExit(Frame frame, EntityRef entity, EntityRef otherEntity)  { }
    public virtual bool OnStaticEnter(Frame frame, int staticID, EntityRef otherEntity)      { return false; }
    public virtual void OnStaticExit(Frame frame, int staticID, EntityRef otherEntity)       { }
}

Back To Top
 

ColliderData

It defines a collider’s visual representation in Unity. Each collider can have only one custom asset, therefore the ColliderData also has an optional reference to TriggerBehavior.

To Document Top