Forum C# System.Void System.Attribute::.ctor()

System.Void System.Attribute::.ctor()

Postby dsaunder » December 20th, 2011, 2:49 am

Any chance System.Attribute stuff can be whitelisted? I'm writing shared code between my server and Unity client and I'm doing stuff like this a lot:

Code: Select all

#if UNITY_3_4
[AddComponentMenu("Game/Whatever")]
#endif
public class Whatever: MonoBehaviour
{
}


I wrote some stub classes to get this to compile on the server without the preprocessor check, but the code scan fails with this:

- error: AddComponentMenu..ctor(...) uses the non-allowed method: System.Void System.Attribute

The real solution would be to pull out my shared code into its own class so I don't have to worry about this, but I'm super lazy ;)

-D
dsaunder
 
Posts: 23
Joined: July 22nd, 2010, 7:28 am

Re: System.Void System.Attribute::.ctor()

Postby Oliver » January 2nd, 2012, 10:40 am

I think the basic System.Attribute can be whitelisted so you can add attributes to stuff. We won't open up for reflection though, so you won't really be able to use it for more than just having your code compile.

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am


Return to C#