blob: e0d63c6c0455cb944954e39605880ec3add0d6a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
using System;
using UnityEngine;
namespace I2.Loc;
[Serializable]
public class EventCallback
{
public MonoBehaviour Target;
public string MethodName = string.Empty;
public void Execute(UnityEngine.Object Sender = null)
{
if (HasCallback() && Application.isPlaying)
{
Target.gameObject.SendMessage(MethodName, Sender, SendMessageOptions.DontRequireReceiver);
}
}
public bool HasCallback()
{
if (Target != null)
{
return !string.IsNullOrEmpty(MethodName);
}
return false;
}
}
|