Event Linkers

Overview

Event linkers are a set of utility scripts that allow you to link together in-game events to activate functions on the components you add to items, maps, or creatures within Unity. All event linkers have a handful of common functions that you can activate which afford you even greater control over the control of your item(s).

Every event linker has the same standard "structure" with mild alterations: You define a list of events (For which you configure the trigger by selecting one from a dropdown selector) which give you a Unity Event to drag/drop GameObjects into in order to invoke methods from the components added to that GameObject. You can (and may even need to) make events with duplicate triggers: The execution order of these events matters!

Using event linkers, you can make items perform complex actions such as playing animations, particles, sounds, etc., introduce puzzle mechanics to your levels, or create custom humanoids with new additions which otherwise wouldn't be possible without writing code.

General Linkers

Item-Focused Linkers

Creature-Focused Linkers

Tip

Event linkers are compatable with both Nomad and PCVR!

Common Functions

The following functions can all be invoked by Unity Events, and provide additional functionality to Event Linkers.

Common Functions Preview

SetListen

This function can be used to toggle a linker's Listening property from an event.

If an event linker is not listening, its events will not trigger even when the associated in-game events occur. This allows you to temporarily disable an event linker. All event linkers are listening by default, but they can be toggled off by unchecking the Listening property in the Unity inspector.

PrintDebug

Prints a message to the ingame console and player log. These may be useful to you if you're trying to figure out why your linker isn't behaving as intended.

Tip

Adding exclamation marks (!) to the start of the message will change the output type of your message.
A single exclamation mark will output a yellow warning message in the console.
Two exclamation marks will output a red error message in the console.

WaitFor…

These functions will add a time delay between the current event, and the next event in the list.

  • WaitForFrames
    • Create a delay that will continue until the specified number of frames have occured.
  • WaitForFixedFrames
    • Create a delay that will continue until the specified number of physics frames have occured.
  • WaitForSeconds
    • Waits a number of in-game seconds. This time is scaled, and will be affected if slow-motion is active.
  • WaitForSecondsRealtime
    • Waits a number of realtime seconds. This delay will not be affected when slow-motion is active.
Warning

WaitFor… creates a delay between events, not within them. Once the delay has elapsed, the next event in the list will be invoked based on if that action occurred in the frame the delay was started in.

This can be used to your advantage to create timers. By adding duplicate events to your events list and adding a delay to the first of these events, you can offset when your UnityEvent is invoked.

The following example will play a particle system when the alternate-use button is pressed while holding a handle, and after five realtime seconds, the particle system will be stopped.

WaitFor Example Usage