WuhuIslandTesting/Library/PackageCache/com.unity.addressables@1.21.12/Tests/Runtime/TestReflectionHelpers.cs
2025-01-07 02:06:59 +01:00

18 lines
643 B
C#

using System.Reflection;
namespace AddressableTests
{
static class TestReflectionHelpers
{
public static void SetResritctMainThreadFileIO(bool errorOnMainThreadFileIO)
{
System.Type t = System.Type.GetType("UnityEngine.IO.File, UnityEngine.CoreModule");
if (t != null)
{
System.Reflection.PropertyInfo pInfo = t.GetProperty("MainThreadIORestrictionMode", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
if (pInfo != null)
pInfo.SetValue(null, errorOnMainThreadFileIO ? 1 : 0);
}
}
}
}