Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- public class DelegateTest:MonoBehaviour
- {
- private delegate void SimpleMethod();
- private SimpleMethod simpleMethod;
- private void Start()
- {
- simpleMethod += Method1;
- simpleMethod += Method2;
- simpleMethod += Method3;
- simpleMethod?.Invoke();
- simpleMethod -= Method2;
- simpleMethod?.Invoke();
- }
- private void Method1()
- {
- Debug.Log("met1");
- }
- private void Method2()
- {
- Debug.Log("met2");
- }
- private void Method3()
- {
- Debug.Log("met3");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement