Skip to content

Events Getting Started

Richard Kopelow edited this page Aug 25, 2018 · 4 revisions

Events - Getting Started

Defining Events

  1. Right click in the project explorer or go to the Asset menu.
  2. Click on Create -> Scriptable Objects -> Events -> Event Type.
    CreateEvent

Handling Events

In Scene

  1. Place a handler of the appropriate type on the listening GameObject.
  2. Link handler code through the Unity event in the Handler script. CreateEvent

In Project

  1. Link handler code directly in the Event
    CreateEvent

Referencing Events

  1. Define a public Event of the type you want.
public FloatEvent DamageDealt;

EventLink
2. Click the arrow icon to the left of the field to set it to either an SO for the event or an event handler. 3. In the editor, link the field to the target.

Firing Events

  1. Reference the event in the firing script.
  2. Call the Fire function.

Manually firing events

  1. Click on the event object in the project.
  2. Give a value to pass to the event when fired.
  3. Click the Fire button.
    /Images/

Clone this wiki locally