Game Creator
  • Welcome to Game Creator!
  • Quickstart
    • Get Started
    • Setup
    • Tutorials
  • Game Creator
    • Game Creator
      • Actions
      • Conditions
      • Triggers
      • Hotspots
      • Characters
        • Player
        • Markers
        • Gestures
        • States
        • Advanced
          • IK in custom Animations
      • Camera
        • Camera Motors
      • Variables
        • Global Variables
        • Local Variables
        • List Variables
    • Systems
      • Localization
      • Event System
      • Timeline
      • UI
      • Module Manager
      • Game Creator Toolbar
      • Pool System
      • Game Creator API
        • Custom Actions
        • Custom Conditions
        • Custom Triggers
        • Custom Hooks
        • Custom Save & Load
        • Variables Access
        • Custom Module
  • Dialogue
    • Dialogue
      • Anatomy
      • Actors
      • Dialogue UI
      • API
  • Inventory
    • Inventory
      • Inventory Window
        • Catalogue
        • Recipes
        • Types
        • Settings
      • Merchants
      • Containers
      • Loot Tables
      • Equip Items
      • Actions
      • Conditions
      • Custom Inventory UI
  • Quests
    • Quests
      • Quests Overview
      • Create Quests
      • Quests UI
        • Custom UI
  • Stats
    • Stats
      • Stats Overview
        • Stat
        • Attributes
        • Status Effects
        • Formulas
        • Stat Modifiers
      • Stats UI
      • Common Use Cases
        • Simple Health Bar
        • Regenerative Mana
        • Poison Status Effect
        • Levels and XP
        • Strength and Armor
        • Lockpicking
  • Behavior
    • Behavior
      • Behavior Graph
        • Nodes
        • Blackboard
      • Perception
  • Shooter
    • Shooter
      • Weapons
      • Ammunition
      • Interaction
      • Examples
        • Example 1 - Get Started
        • Example 2 - Pick Weapons
        • Example 3 - Top Down
        • Example 4 - Side Scroll
        • Example 5 - First Person
        • Example 6 - Combat
      • Advanced
        • Custom Crosshairs
        • Shooter API
  • Melee
    • Melee
      • Weapons
        • Blade Component
      • Shields
      • Melee Clips
      • Combat
  • Traversal
    • Traversal
      • Obstacles
      • Climbables
      • Built-in Elements
  • Annex
    • Roadmap
    • FAQ
Powered by GitBook
On this page

Was this helpful?

  1. Game Creator
  2. Systems
  3. Game Creator API

Custom Triggers

PreviousCustom ConditionsNextCustom Hooks

Last updated 6 years ago

Was this helpful?

Triggers are the bridge between some kind of input and the execution of Actions and Events. What receives this input and decides whether the Trigger should be fired or not are a hidden component called Igniters.

So when we talk about creating custom Triggers, we're actually talking about custom Igniters. And these work pretty much the same way as Actions and Conditions.

IgniterExample.cs

[AddComponentMenu("")]
public class IgniterCollisionEnter : Igniter 
{
    #if UNITY_EDITOR
    public new static string NAME = "Example/Example";
    public new static bool REQUIRES_COLLIDER = true;
    #endif

    void Start()
    {
        this.ExecuteTrigger(null);
    }
}

In the example above you see an example of Igniter that tells the Trigger to fire the Actions and Events as soon as the Start method is called.

It is worth noting that it requires the static property NAME and this needs to be unique. The REQUIRES_COLLIDER property is optional and tells the Editor that this Trigger needs to have a collider attached.

Unlike Actions and Conditions, Igniters don't an Editor section to display the Inspector's UI

The Igniter class inherits from MonoBehaviour. That means that you have all the typical methods at your disposal, including the Awake, Update, OnColliderEnter, ...

(An Igniter tells the Trigger: Hey! Invoke the Actions & Events)