diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs index 290cfb91c..4a543029f 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs @@ -65,10 +65,7 @@ namespace UniJSON throw new ArgumentException(string.Format(""{0} is not static"", m)); } - return ($1) => - { - m.Invoke(null, new object[] { $1 }); - }; + return (Action<$0>)Delegate.CreateDelegate(typeof(Action<$0>), null, m); } ".Replace("$0", g).Replace("$1", a); @@ -91,10 +88,7 @@ namespace UniJSON throw new ArgumentException(string.Format(""{0} is static"", m)); } - return (s, $1) => - { - m.Invoke(s, new object[] { $1 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), m); } ".Replace("$0", g).Replace("$1", a); @@ -117,10 +111,7 @@ namespace UniJSON throw new ArgumentException(string.Format(""{0} is static"", m)); } - return ($1) => - { - m.Invoke(instance, new object[] { $1 }); - }; + return (Action<$0>)Delegate.CreateDelegate(typeof(Action<$0>), instance, m); } ".Replace("$0", g).Replace("$1", a); @@ -143,7 +134,7 @@ namespace UniJSON throw new ArgumentException(string.Format(""{0} is not static"", m)); } - return ($1) => (T)m.Invoke(null, new object[] { $1 }); + return (Func<$0, T>)Delegate.CreateDelegate(typeof(Func<$0, T>), null, m); } ".Replace("$0", g).Replace("$1", a); @@ -166,7 +157,7 @@ namespace UniJSON throw new ArgumentException(string.Format(""{0} is static"", m)); } - return (s, $1) => (T)m.Invoke(s, new object[] { $1 }); + return (Func)Delegate.CreateDelegate(typeof(Func), m); } ".Replace("$0", g).Replace("$1", a); @@ -189,7 +180,7 @@ namespace UniJSON throw new ArgumentException(string.Format(""{0} is static"", m)); } - return ($1) => (T)m.Invoke(instance, new object[] { $1 }); + return (Func<$0, T>)Delegate.CreateDelegate(typeof(Func<$0, T>), instance, m); } ".Replace("$0", g).Replace("$1", a); @@ -218,10 +209,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is not static", m)); } - return () => - { - m.Invoke(null, new object[] { }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), null, m); } public static Action OpenAction(MethodInfo m) diff --git a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs index 209b49be0..88024387c 100644 --- a/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs +++ b/Assets/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs @@ -17,10 +17,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is not static", m)); } - return (a0) => - { - m.Invoke(null, new object[] { a0 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), null, m); } @@ -31,10 +28,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is not static", m)); } - return (a0, a1) => - { - m.Invoke(null, new object[] { a0, a1 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), null, m); } @@ -45,10 +39,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is not static", m)); } - return (a0, a1, a2) => - { - m.Invoke(null, new object[] { a0, a1, a2 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), null, m); } @@ -59,10 +50,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is not static", m)); } - return (a0, a1, a2, a3) => - { - m.Invoke(null, new object[] { a0, a1, a2, a3 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), null, m); } //////////// OpenAction @@ -74,10 +62,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is static", m)); } - return (s, a0) => - { - m.Invoke(s, new object[] { a0 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), m); } @@ -88,10 +73,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is static", m)); } - return (s, a0, a1) => - { - m.Invoke(s, new object[] { a0, a1 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), m); } @@ -102,10 +84,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is static", m)); } - return (s, a0, a1, a2) => - { - m.Invoke(s, new object[] { a0, a1, a2 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), m); } //////////// BindAction @@ -117,10 +96,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is static", m)); } - return (a0) => - { - m.Invoke(instance, new object[] { a0 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), instance, m); } @@ -131,10 +107,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is static", m)); } - return (a0, a1) => - { - m.Invoke(instance, new object[] { a0, a1 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), instance, m); } @@ -145,10 +118,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is static", m)); } - return (a0, a1, a2) => - { - m.Invoke(instance, new object[] { a0, a1, a2 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), instance, m); } @@ -159,10 +129,7 @@ namespace UniJSON throw new ArgumentException(string.Format("{0} is static", m)); } - return (a0, a1, a2, a3) => - { - m.Invoke(instance, new object[] { a0, a1, a2, a3 }); - }; + return (Action)Delegate.CreateDelegate(typeof(Action), instance, m); } //////////// StaticFunc