Trigger - Variables


Transform Target

The Target the Trigger detects.

If null, the Target of the Railcam2DCore component is used by default. Only assign a value if you want the Trigger to detect a different object to the Railcam 2D Target.


Railcam2D.TriggerEvent Event

The Event that occurs when the Trigger detects its Target.

An enum with a choice of "Connect To Selected Rail", "Disconnect From Selected Rail", "Disconnect From All Rails" or "Generic". The inbuilt Events revolve around managing the camera's Rail connections. To use the Trigger for custom Events, set the Event to Generic and check for Trigger.TargetDetected.

Selected Rail

Railcam2D.Rail SelectedRail

The Rail the Trigger's Event refers to.

Scan Interval

float ScanInterval

The time in seconds the Trigger waits between each scan for the Target.

To avoid multiple Triggers scanning on the same frame (to reduce load), this value is randomly offset by up to 0.05s each time a scan occurs. A lower scanning frequency also helps to reduce load. If you have a fast-moving Target, consider using a smaller value to increase the scan frequency.

Start Active

bool StartActive

Determines if the Trigger starts the scene scanning for the Target.

Activate or deactivate the Trigger during runtime by calling the Trigger.Activate() and Trigger.Deactivate() methods.


Railcam2D.TriggerShape Shape

The shape of the Trigger's detection area.


Vector2 Position

The position of the Trigger in a scene.


float Radius

The radius of the Trigger's detection area when Shape is set to Circle.


Vector2 Size

The height and width of the Trigger's detection area when Shape is set to Rectangle.