'System.Type' does not contain a definition for 'GetField' - Windows Store App

Hi Developers, writing short so you don’t spend much time on my post.

I bought a complete project from asset store, it works perfect on platforms i checked, but when i build that for windows store, it gives me same error in many scripts. i found few solution having the same error but different code scenario, and i keep failing to implement solution into code. Everywhere in the code where GetField is used it gives me error :frowning: That is just when building it for Windows Store.

error CS1061: ‘System.Type’ does not contain a definition for ‘GetField’ and no extension method ‘GetField’ accepting a first argument of type ‘System.Type’ could be found (are you missing a using directive or an assembly reference?)

→ FieldInfo[ ] properties = aClass.GetType().GetFields();
→ return System.Type.GetType(aComponent);

I will be waiting for kind responses. Thank You.

GetField is a reflection call. The normal reflection calls are not available in windows store apps, see here.

It seems like you can only use the API calls available in .NET for Windows apps, which Windows in their infinite wisdom has decided should be a gimped version of .NET (if you’re wondering why they have to offer money to get people to make stuff for the platform, this is a part of it).

The big problem here is that .NET for Windows apps is based on .NET 4.5. Unity’s Mono implementation is far beyond that, so the reflection features that’s available for windows apps might not be accessible in Unity. It’s probably possible to work around this - I’ve seen people using C# 6 features - but it’ll take a bit of searching around. Somebody else might have a better idea about that.