ZeroVR/ZeroPacientVR/Assets/Scripts/AnimProxy.cs

23 lines
574 B
C#

using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
namespace UnityTemplateProjects
{
public class AnimProxy : MonoBehaviour
{
[SerializeField] private Component mono;
private Dictionary<string, MethodInfo> cache = new Dictionary<string, MethodInfo>();
public void AnimProxyCallback(string method)
{
if (!cache.ContainsKey(method))
{
cache[method] = mono.GetType().GetMethod(method);
}
cache[method].Invoke(mono, null);
}
}
}