You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
使用枚举类型扩展函数会导致E:CSharpException:ArgumentNullException: Value cannot be null 报错.
无法patch的C#代码如下:
using UnityEngine;
public class Test : MonoBehaviour
{
void Start() {
TestEnum.A.TestFunc();
}
}
public enum TestEnum {
A,
B,
C
}
public static class TestStatic {
public static void TestFunc(this TestEnum type) {
Debug.Log(type.ToString());
}
}
修改成常规静态方法不再报错,修改后如下:
using UnityEngine;
public class Test : MonoBehaviour
{
void Start() {
TestStatic.TestFunc(TestEnum.A);
}
}
public enum TestEnum {
A,
B,
C
}
public static class TestStatic {
public static void TestFunc(TestEnum type) {
Debug.Log(type.ToString());
}
}
The text was updated successfully, but these errors were encountered:
使用枚举类型扩展函数会导致E:CSharpException:ArgumentNullException: Value cannot be null 报错.
无法patch的C#代码如下:
using UnityEngine;
public class Test : MonoBehaviour
{
void Start() {
TestEnum.A.TestFunc();
}
}
public enum TestEnum {
A,
B,
C
}
public static class TestStatic {
public static void TestFunc(this TestEnum type) {
Debug.Log(type.ToString());
}
}
修改成常规静态方法不再报错,修改后如下:
using UnityEngine;
public class Test : MonoBehaviour
{
void Start() {
TestStatic.TestFunc(TestEnum.A);
}
}
public enum TestEnum {
A,
B,
C
}
public static class TestStatic {
}
The text was updated successfully, but these errors were encountered: