コード例 #1
0
    private static void SetStandalonePlatformData(UnityEditor.PluginImporter pluginImporter, string platformName, string architecture)
    {
        var isLinux   = platformName == "Linux";
        var isWindows = platformName == "Windows";
        var isMac     = platformName == "Mac";
        var isX86     = architecture == "x86";
        var isX64     = architecture == "x86_64";

#if !UNITY_2019_2_OR_NEWER
        pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneLinux, "CPU", isLinux && isX86 ? "x86" : "None");
        pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneLinuxUniversal, "CPU", !isLinux ? "None" : isX86 ? "x86" : isX64 ? "x86_64" : "None");
#endif
        pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneLinux64, "CPU", isLinux && isX64 ? "x86_64" : "None");
        pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneWindows, "CPU", isWindows && isX86 ? "AnyCPU" : "None");
        pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneWindows64, "CPU", isWindows && isX64 ? "AnyCPU" : "None");
        pluginImporter.SetPlatformData(UnityEditor.BuildTarget.StandaloneOSX, "CPU", isMac ? "AnyCPU" : "None");
    }
コード例 #2
0
 public void ValidateSingleCPUTargets(PluginImporterInspector inspector)
 {
     DesktopPluginImporterExtension.DesktopSingleCPUProperty[] array = new DesktopPluginImporterExtension.DesktopSingleCPUProperty[]
     {
         this.m_WindowsX86,
         this.m_WindowsX86_X64,
         this.m_LinuxX86,
         this.m_LinuxX86_X64,
         this.m_OSX_X64
     };
     DesktopPluginImporterExtension.DesktopSingleCPUProperty[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         DesktopPluginImporterExtension.DesktopSingleCPUProperty desktopSingleCPUProperty = array2[i];
         string           value     = (!desktopSingleCPUProperty.IsTargetEnabled(inspector)) ? DesktopPluginImporterExtension.DesktopPluginCPUArchitecture.None.ToString() : desktopSingleCPUProperty.defaultValue.ToString();
         PluginImporter[] importers = inspector.importers;
         for (int j = 0; j < importers.Length; j++)
         {
             PluginImporter pluginImporter = importers[j];
             pluginImporter.SetPlatformData(desktopSingleCPUProperty.platformName, "CPU", value);
         }
     }
     this.ValidateUniversalTargets(inspector);
 }
コード例 #3
0
        private void ValidateUniversalTargets(PluginImporterInspector inspector)
        {
            bool flag  = this.m_LinuxX86.IsTargetEnabled(inspector);
            bool flag2 = this.m_LinuxX86_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture = this.CalculateMultiCPUArchitecture(flag, flag2);
            PluginImporter[] importers = inspector.importers;
            for (int i = 0; i < importers.Length; i++)
            {
                PluginImporter pluginImporter = importers[i];
                pluginImporter.SetPlatformData(BuildTarget.StandaloneLinuxUniversal, "CPU", desktopPluginCPUArchitecture.ToString());
            }
            inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneLinuxUniversal), flag || flag2);
            bool flag3 = this.m_OSX_X64.IsTargetEnabled(inspector);

            DesktopPluginImporterExtension.DesktopPluginCPUArchitecture desktopPluginCPUArchitecture2 = this.CalculateMultiCPUArchitecture(true, flag3);
            PluginImporter[] importers2 = inspector.importers;
            for (int j = 0; j < importers2.Length; j++)
            {
                PluginImporter pluginImporter2 = importers2[j];
                pluginImporter2.SetPlatformData(BuildTarget.StandaloneOSX, "CPU", desktopPluginCPUArchitecture2.ToString());
            }
            inspector.SetPlatformCompatibility(BuildPipeline.GetBuildTargetName(BuildTarget.StandaloneOSX), flag3);
        }
コード例 #4
0
 private static void SetStandaloneTarget(PluginImporter pluginImporter, BuildTarget target)
 {
     switch(target)
     {
     case BuildTarget.StandaloneLinux:
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux, "CPU", "x86");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinuxUniversal, "CPU", "x86");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXUniversal, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows64, "CPU", "None");
         return;
     case BuildTarget.StandaloneLinux64:
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux64, "CPU", "x86_64");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinuxUniversal, "CPU", "x86_64");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXUniversal, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows64, "CPU", "None");
         return;
     case BuildTarget.StandaloneOSXIntel:
     case BuildTarget.StandaloneOSXIntel64:
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinuxUniversal, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel, "CPU", "AnyCPU");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel64, "CPU", "AnyCPU");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXUniversal, "CPU", "AnyCPU");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows64, "CPU", "None");
         return;
     case BuildTarget.StandaloneWindows:
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinuxUniversal, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXUniversal, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows, "CPU", "AnyCPU");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows64, "CPU", "None");
         return;
     case BuildTarget.StandaloneWindows64:
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinux64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneLinuxUniversal, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXIntel64, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneOSXUniversal, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows, "CPU", "None");
         pluginImporter.SetPlatformData (BuildTarget.StandaloneWindows64, "CPU", "AnyCPU");
         return;
     default:
         return;
     }
 }
コード例 #5
0
 private void UpgradePluginCPU(PluginImporter plugin, BuildTarget buildTarget)
 {
     string extension = Path.GetExtension(plugin.assetPath);
     string platformData = plugin.GetPlatformData(buildTarget, "CPU");
     if ((extension == ".so") && (platformData == "AnyCPU"))
     {
         plugin.SetPlatformData(buildTarget, "CPU", "ARMv7");
     }
 }