GenericUnityObjects
GenericUnityObjects copied to clipboard
IgnoresAccessChecksTo doesn't work with Reflection.Emit
To overcome an issue with the inability to use internal generic UnityEngine.Objects, I tried adding the IgnoresAccessChecksTo attribute when emitting assemblies. This seems to be working at least for these guys.
However, when creating an asset from an internal generic type, I receive the following error:
MethodAccessException: Method `Testing.GenericSO`1[System.Boolean]..ctor()' is inaccessible from method `ConcreteClass_d9b9a1d4e06775a45aa383810177c43c..ctor()'
I added a dirty example of how IgnoresAccessChecksTo can be used in the plugin to the ignores-access-checks-to branch. Feel free to check it out.
When I created a concrete class manually using OpenSesame, it was instatiated without the MethodAccessException error, so something's wrong with emitting IgnoresAccessChecksTo in Reflection.Emit.
Does anyone have an idea, what else can be done to bypass the visibility check for internal generic types?