0
\$\begingroup\$

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

\$\endgroup\$
2
  • \$\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, 2018 at 16:36
  • \$\begingroup\$ Just wanted to add that Unity has made this method public i e: [BuildPipeline.IsTargetPlatformSupported][1] [1]:docs.unity3d.com/ScriptReference/… \$\endgroup\$
    – Titantompa
    Mar 23, 2022 at 8:20

2 Answers 2

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, 2018 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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .