0
\$\begingroup\$

How can I find out from script(c#) did I download specific platfrom support for current Unity version?

\$\endgroup\$
1
  • \$\begingroup\$ Can you give us a little more context about what you're doing that needs to query this information from script? \$\endgroup\$ – DMGregory Sep 28 '18 at 16:36
0
\$\begingroup\$

When you install Unity , you can choose from a list of supported "build" platform:

  • Windows
  • Max
  • iOS
  • Android

and so on.

So you can build specific platform.

You can't check it from C#.

\$\endgroup\$
1
  • \$\begingroup\$ Could you use the scriptable build pipeline to try to kick off a build of a trivial/empty project om each platform, and trap the ones that generate an error? Not an efficient method by any means, but might not be impossible. \$\endgroup\$ – DMGregory Sep 28 '18 at 14:15
0
\$\begingroup\$

Found out the solution. You should dive in into Unity native classes and get info from there:

        var moduleManager = System.Type.GetType("UnityEditor.Modules.ModuleManager,UnityEditor.dll");
        var isPlatformSupportLoaded = moduleManager.GetMethod("IsPlatformSupportLoaded", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
        var getTargetStringFromBuildTarget = moduleManager.GetMethod("GetTargetStringFromBuildTarget", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);

        return (bool)isPlatformSupportLoaded.Invoke(null, new object[] { (string)getTargetStringFromBuildTarget.Invoke(null, new object[] { BuildTarget.tvOS }) });
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.