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.