Using Signal Emitters to Access C# Scripts

Dennisse Pagán Dávila
C# Programming
Published in
4 min readFeb 22

--

Unity 2019.1 introduced Signal Emitters, a feature that establishes a communication channel that allows Timeline to interact with outside systems in your project, including scripts.

Let’s take a look at how you can use this to your advantage when scripting!

Objective: Learn what signal emitters are, how to use them to interact with scripts, and how they can be helpful.

Table of Contents

· Why use Signal Emitters?
· Adding a Signal Emitter
Signal Emitter Contents
Signal Asset and Signal Receiver Contents
· Accessing the Script
· The Result

Why use Signal Emitters?

Imagine you’ve created a cutscene or intricate animation and at the end of it, you want to trigger an event that happens to be controlled by a script. To visualize this a bit more, think of how quick-time events are structured in video games — they appear to be cutscenes with gameplay events interwoven into them.

With the use of Signal Emitter, you can create markers anywhere inside a cutscene or sequence and tell your program “Hey, there’s an event here that needs to be triggered at this point”.

Let’s have a look at this step by step.

Adding a Signal Emitter

I have a simple animation sequence on my Timeline, at the end of this sequence, I want to load a new scene. I will explain the individual parts of this process as I go along, including the parts of a signal emitter.

  1. First, make sure my Playhead/Timeline ruler (the white indicator) is placed exactly where I want my signal emitter to be. Then I access the three-dotted menu and add a Signal Emitter.

Signal Emitter Contents

The signal emitter is represented by a white indicator in your Timeline. This contains a reference to the Signal Asset which we’ll add in the next step.

2. Add a Signal Asset, you can access this in the Inspector while your Signal Emitter is selected in the Timeline. You should create a folder to store your signals prior to doing this.

Signal Asset and Signal Receiver Contents

A Signal Asset is a connection or association between the Signal Emitter and the Signal Receiver.

The Signal Reciever is automatically created when you add a Signal Asset, this component holds a list of reactions, each of which is linked to a Signal Asset. Here you can see the Receiver Component on a Sphere object because that is the object which is controlled by the Playable Director in our Timeline.

Your Signal Emitter should be all set up now.

Accessing the Script

I created a script that is attached to my Sphere, the same object that has the Signal Receiver and Asset.

  1. Make sure that the function you want to use for your emitter is public.

2. Go to your Singal Recevier and you should be able to find the public function in the drop-down list of reactions.

Find the name of your script(mine is LoadSignal) → find the right function.

Now when your Timeline reaches the point where you placed the Signal Emitter, whatever effect you’ve programmed into the function should be triggered.

The Result

Signal Emitter triggering a Load Scene.

I hope you have found this information valuable! Follow me for more Unity Development articles! :) I am a passionate Unity Developer and Writer on a journey to join the video game industry. Check out my LinkedIn and Twitter!

--

--

Dennisse Pagán Dávila
C# Programming

Video Game Design and Development graduate that specializes in Unity Game Development. Currently looking for new opportunities. LinkedIn: https://rb.gy/xdu8nu