This document is about: QUANTUM 2
SWITCH TO

Collider Custom Assets


Available in the Gaming Circle and Industries Circle
Circle

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.

TriggerBehavior

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

C#

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)       { }
}

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.

Back to top