Adding InstructionEvent to the controller

The first step in refactoring our code to use events and listeners is to define a UnityEvent called InstructionEvent. Open InstructionsController.cs and add the following:

File: InstructionsController.cs 
using UnityEngine.Events; 
 
public class InstructionEvent : UnityEvent<InstructionStep> { } 
 
public class InstructionsController : MonoBehaviour { 
    public InstructionEvent OnInstructionUpdate = new InstructionEvent(); 
 
... 

As you can see, we also declare a public InstructionEvent named OnInstructionUpdate, which is what all our UIs will be listening to, so we can ensure they update correctly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.113.197