-
-
Save timrodz/21e7339f8dab8d3a0ac532b8012f274f to your computer and use it in GitHub Desktop.
Delegate Tutorial Step 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class EventController : MonoBehaviour | |
{ | |
// The delegate is our signature-- Define your parameters between the parentheses | |
public delegate void OnMessageUpdateRequestDelegate(string _message); | |
// This will be the delegate we're subscribing towards | |
public static OnMessageUpdateRequestDelegate OnMessageUpdateRequest; | |
public static void Event_OnMessageUpdateRequest(string _message) | |
{ | |
Debug.LogFormat("-- EventController // Received a request to update message: {0}", _message); | |
OnMessageUpdateRequest(_message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment