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 Hooks

Hooks are Unity components that allow you to easily access unique objects such as the Player or the Main Camera. Their use is not required but useful if you want to simplify the process of selecting common objects.

Let's say you want to detect when the player enters a certain area with a Trigger.

Instead of setting the Trigger to Enter and dragging and dropping the Player game object into the target field, you can simply mark the collideWithPlayer checkbox and it automatically looks for the Player.

Creating a custom hook is really easy. Game Creator already provides a hook for some components but if you want, for example, to create one for the player's Dragonfly, you can create a class that inherits from IHook as follows:

public class HookDragonfly : IHook<HookDragonfly> {}

Notice that using Hooks requires to use the GameCreator.Core.Hooks namespace

That's all. Add this component to you game object and you'll be able to access it using HookDragonfly.Instance.

PreviousCustom TriggersNextCustom Save & Load

Last updated 7 years ago

Was this helpful?