void Start()
        {
#if UNITY_EDITOR
            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                if (playerSettingsCompanyName == "" || playerSettingsCompanyName != PlayerSettings.companyName)
                {
                    playerSettingsCompanyName = PlayerSettings.companyName;
                }

                if (playerSettingsProductName == "" || playerSettingsProductName != PlayerSettings.productName)
                {
                    playerSettingsProductName = PlayerSettings.productName;
                }

#if UNITY_2018_3_OR_NEWER
#if !UNITY_2019_3_OR_NEWER
                if (PlayerSettings.scriptingRuntimeVersion != ScriptingRuntimeVersion.Latest)
                {
                    Debug.LogError("StandalonePlayerResolutionHelper :: PlayerSettings.scriptingRuntimeVersion is Lagacy");
                }
#endif

                if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone) != ApiCompatibilityLevel.NET_4_6)
                {
                    Debug.LogError("StandalonePlayerResolutionHelper :: PlayerSettings.ApiCompatibilityLevel is Low");
                }
#endif
            }
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Default ctor
        /// </summary>
        /// <remarks>
        /// If your <see cref="data"/> type pulls in non default-referenced types, you'll need to add them to <see cref="additionalRuntimeTypes"/>
        /// </remarks>
        /// <param name="data">data to host</param>
        /// <param name="additionalRuntimeTypes">additional types to bring in</param>
        public UnityDataHost(TData data, IEnumerable <string> additionalRuntimeTypes)
        {
            var dataType = data.GetType();

            Data = data;

            SafeAddRangeRef(new [] { typeof(Object).Assembly.Location, typeof(IDataHost <>).Assembly.Location, dataType.Assembly.Location });
            SafeAddRangeImport(new [] { typeof(Object).Namespace, typeof(IDataHost <>).Namespace, dataType.Namespace });

            foreach (var childType in ReflectionUtils.ChildTypes(dataType))
            {
                SafeAddRef(childType.Assembly.Location);
                SafeAddImport(childType.Namespace);
            }

            foreach (var additionalType in additionalRuntimeTypes)
            {
                var typ = Type.GetType(additionalType);
                SafeAddRef(typ?.Assembly.Location);
                SafeAddImport(typ?.Namespace);
            }

            var apiCompatLevel = PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup);

            if (apiCompatLevel == ApiCompatibilityLevel.NET_Standard_2_0)
            {
                // always add netstandard - if you're in an editor only assembly it's a no-op, and you need it for non-editor dlls
                var netStandardPath = Assembly.Load(new AssemblyName("netstandard")).Location;
                SafeAddRef(netStandardPath);
            }
        }
Ejemplo n.º 3
0
        private void GatherCurrentSettings()
        {
            BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget;

            buildTargetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget);
            currentLevel     = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns the configured <see cref="TargetFramework"/> for the <see cref="BuildTargetGroup"/>.
        /// </summary>
        /// <param name="this">The <see cref="BuildTargetGroup"/> to get <see cref="TargetFramework"/> for.</param>
        /// <returns>The <see cref="TargetFramework"/> configured for given <see cref="BuildTargetGroup"/>.</returns>
        public static TargetFramework GetTargetFramework(this BuildTargetGroup @this)
        {
            if (@this == BuildTargetGroup.Unknown)
            {
                // This may be different on older unity versions
                return(TargetFramework.Net46);
            }

            switch (PlayerSettings.GetApiCompatibilityLevel(@this))
            {
            case ApiCompatibilityLevel.NET_2_0:
            case ApiCompatibilityLevel.NET_2_0_Subset:
                return(TargetFramework.Net20);

            case ApiCompatibilityLevel.NET_4_6:
                return(TargetFramework.Net46);

            case ApiCompatibilityLevel.NET_Web:
            case ApiCompatibilityLevel.NET_Micro:
                throw new PlatformNotSupportedException("Don't currently support NET_Web and NET_Micro API compat");

            case ApiCompatibilityLevel.NET_Standard_2_0:
                return(TargetFramework.NetStandard20);
            }

            throw new PlatformNotSupportedException("ApiCompatibilityLevel platform not matched.");
        }
Ejemplo n.º 5
0
        public void RunCompileAndLink()
        {
            var il2CppNativeCodeBuilder = m_PlatformProvider.CreateIl2CppNativeCodeBuilder();

            if (il2CppNativeCodeBuilder != null)
            {
                Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder);

                var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(m_PlatformProvider.target);
                var useDebugBuild    = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup) == Il2CppCompilerConfiguration.Debug;
                var arguments        = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, OutputFileRelativePath(), m_PlatformProvider.includePaths, useDebugBuild).ToList();

                arguments.Add(string.Format("--map-file-parser=\"{0}\"", GetMapFileParserPath()));
                arguments.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(GetCppOutputDirectoryInStagingArea())));
                if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_4_6)
                {
                    arguments.Add("--dotnetprofile=\"unityjit\"");
                }
                if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_Standard_2_0)
                {
                    arguments.Add("--dotnetprofile=\"unityaot\"");
                }
                Action <ProcessStartInfo> setupStartInfo = il2CppNativeCodeBuilder.SetupStartInfo;
                var managedDir = Path.GetFullPath(Path.Combine(m_StagingAreaData, "Managed"));

                RunIl2CppWithArguments(arguments, setupStartInfo, managedDir);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets .NET API compatibility level for current BuildTargetGroup.
        /// </summary>
        internal static ApiCompatibilityLevel GetCurrentCompatibilityLevel()
        {
            BuildTarget      buildTarget      = EditorUserBuildSettings.activeBuildTarget;
            BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget);

            return(PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup));
        }
Ejemplo n.º 7
0
    public void CheckCompatibility()
    {
#if UNITY_5_6
        if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone) == ApiCompatibilityLevel.NET_2_0_Subset)
#else
        if (PlayerSettings.apiCompatibilityLevel == ApiCompatibilityLevel.NET_2_0_Subset)
#endif
        {
            SetGUIBackgroundColor("#ef5350");
            EditorGUILayout.HelpBox("Uduino works only with .NET 2.0 (not Subset).", MessageType.Error, true);
            if (GUILayout.Button("Fix Now", GUILayout.ExpandWidth(true)))
            {
#if UNITY_5_6
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, ApiCompatibilityLevel.NET_2_0);
#else
                PlayerSettings.apiCompatibilityLevel = ApiCompatibilityLevel.NET_2_0;
#endif
                PlayerSettings.runInBackground = true;
                Debug.LogWarning("Reimporting all assets.");
                AssetDatabase.ImportAsset("Assets/Uduino/Scripts", ImportAssetOptions.ImportRecursive);
                AssetDatabase.Refresh();
            }
            SetGUIBackgroundColor();
        }
    }
        public void OnGUI()
        {
            var target = EditorUserBuildSettings.activeBuildTarget;
            var group  = BuildPipeline.GetBuildTargetGroup(target);

            // Api Compatibility Level
            if (PlayerSettings.GetApiCompatibilityLevel(group) != ApiCompatibilityLevel.NET_4_6)
            {
                GUILayout.BeginHorizontal();
                EditorGUILayout.HelpBox("Api Compatibility Level should be set to .NET 4.x in Player Settings", MessageType.Warning);
                if (GUILayout.Button(fixButtonLabel))
                {
                    PlayerSettings.SetApiCompatibilityLevel(group, ApiCompatibilityLevel.NET_4_6);
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                EditorGUILayout.HelpBox("Api Compatibility Level is set to .NET 4.x in Player Settings", MessageType.Info);
            }

            // TODO : ARM64 Target

            // TODO : iOS Minimum Version

            // TODO : Android  Minimum Version

            // TODO : add warnings/fixes for other Reflect related settings
        }
Ejemplo n.º 9
0
    public static void ConfigurePlayerSettings()
    {
        Debug.Log("Setting required PlayerSettings...");

        SetBuildTarget();

        // Needed for Microsoft.CSharp namespace in DLLMaker
        // Doesn't seem to work though
        if (PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup) != ApiCompatibilityLevel.NET_2_0)
        {
            PlayerSettings.SetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup, ApiCompatibilityLevel.NET_2_0);
        }

        if (!PlayerSettings.runInBackground)
        {
            PlayerSettings.runInBackground = true;
        }

        SetDefaultGraphicsAPIs();
        SetGraphicsSettings();
        SetPlayerSettings();

#if VRC_CLIENT
        RefreshClientVRSDKs();
#else
        // SDK

        // default to steam runtime in sdk (shouldn't matter)
        SetVRSDKs(new string[] { "None", "OpenVR", "Oculus" });

        VRC.Core.AnalyticsSDK.Initialize(VRC.Core.SDKClientUtilities.GetSDKVersionDate());
#endif
    }
Ejemplo n.º 10
0
        public void RunCompileAndLink()
        {
            Il2CppNativeCodeBuilder il2CppNativeCodeBuilder = this.m_PlatformProvider.CreateIl2CppNativeCodeBuilder();

            if (il2CppNativeCodeBuilder != null)
            {
                Il2CppNativeCodeBuilderUtils.ClearAndPrepareCacheDirectory(il2CppNativeCodeBuilder);
                BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(this.m_PlatformProvider.target);
                bool             debugBuild       = PlayerSettings.GetIl2CppCompilerConfiguration(buildTargetGroup) == Il2CppCompilerConfiguration.Debug;
                List <string>    list             = Il2CppNativeCodeBuilderUtils.AddBuilderArguments(il2CppNativeCodeBuilder, this.OutputFileRelativePath(), this.m_PlatformProvider.includePaths, debugBuild).ToList <string>();
                list.Add(string.Format("--map-file-parser=\"{0}\"", IL2CPPBuilder.GetMapFileParserPath()));
                list.Add(string.Format("--generatedcppdir=\"{0}\"", Path.GetFullPath(this.GetCppOutputDirectoryInStagingArea())));
                if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_4_6)
                {
                    list.Add("--dotnetprofile=\"net45\"");
                }
                if (PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup) == ApiCompatibilityLevel.NET_Standard_2_0)
                {
                    list.Add("--dotnetprofile=\"unityaot\"");
                }
                Action <ProcessStartInfo> setupStartInfo = new Action <ProcessStartInfo>(il2CppNativeCodeBuilder.SetupStartInfo);
                string fullPath = Path.GetFullPath(Path.Combine(this.m_StagingAreaData, "Managed"));
                this.RunIl2CppWithArguments(list, setupStartInfo, fullPath);
            }
        }
Ejemplo n.º 11
0
        static SetApiLevel()
        {
            BuildTarget      target = EditorUserBuildSettings.activeBuildTarget;
            BuildTargetGroup group  = BuildPipeline.GetBuildTargetGroup(target);

#if UNITY_2018_1_OR_NEWER
            ApiCompatibilityLevel level = ApiCompatibilityLevel.NET_4_6;
#else
            ApiCompatibilityLevel level = ApiCompatibilityLevel.NET_2_0;
#endif
#if UNITY_STANDALONE_WIN
            ScriptingImplementation scriptingBackend = ScriptingImplementation.Mono2x;
#else
            ScriptingImplementation scriptingBackend = PlayerSettings.GetScriptingBackend(group);
#endif

            //Debug.Log("API level: " + PlayerSettings.GetApiCompatibilityLevel(group));
            //Debug.Log("Scripting backend: " + PlayerSettings.GetScriptingBackend(group));

            if (PlayerSettings.GetApiCompatibilityLevel(group) != level || PlayerSettings.GetScriptingBackend(group) != scriptingBackend)
            {
                PlayerSettings.SetApiCompatibilityLevel(group, level);
                PlayerSettings.SetScriptingBackend(group, scriptingBackend);
                Debug.Log("API level changed to '" + level + "' (" + scriptingBackend + ")");
            }
        }
Ejemplo n.º 12
0
    // Can also be used to check if any settings need to be changed
    public static bool UpdatePlayerSettings(bool actually_apply)
    {
        bool something_changed = false;

        if (!PlayerSettings.allowUnsafeCode)
        {
            something_changed = true;
            if (actually_apply)
            {
                PlayerSettings.allowUnsafeCode = true;
            }
        }
        if (PlayerSettings.scriptingRuntimeVersion != ScriptingRuntimeVersion.Latest)
        {
            something_changed = true;
            if (actually_apply)
            {
                PlayerSettings.scriptingRuntimeVersion = ScriptingRuntimeVersion.Latest;
                Debug.Log("Set Scripting Runtime Version to .NET 4.x, restart editor!");
            }
        }
        if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone) != ApiCompatibilityLevel.NET_4_6)
        {
            something_changed = true;
            if (actually_apply)
            {
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, ApiCompatibilityLevel.NET_4_6);
                Debug.Log("Set Api Compatibility Level to .NET 4.x, restart editor!");
            }
        }
        return(something_changed);
    }
Ejemplo n.º 13
0
    static bool PlayerCheck()
    {
        bool isApply = true;

        if (PlayerSettings.Android.minSdkVersion < AndroidSdkVersions.AndroidApiLevel24)
        {
            isApply = false;
        }
        if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Android) != ApiCompatibilityLevel.NET_4_6)
        {
            isApply = false;
        }
        if (PlayerSettings.GetMobileMTRendering(BuildTargetGroup.Android) == true)
        {
            isApply = false;
        }

        UnityEngine.Rendering.GraphicsDeviceType[] gapi = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android);

        if (gapi.Length != 1 || gapi[0] != UnityEngine.Rendering.GraphicsDeviceType.OpenGLES3)
        {
            isApply = false;
        }

        if (PlayerSettings.defaultInterfaceOrientation != UIOrientation.LandscapeLeft)
        {
            isApply = false;
        }

        return(isApply);
    }
Ejemplo n.º 14
0
        public static IEnumerable <PlayInstantSettingPolicy> GetRecommendedPolicies()
        {
            var policies = new List <PlayInstantSettingPolicy>
            {
                new PlayInstantSettingPolicy(
                    "Android minSdkVersion should be 21",
                    "Lower than 21 is fine, though 21 is the minimum supported by Google Play Instant.",
                    // TODO: consider prompting if strictly greater than 21 to say that 21 enables wider reach
                    () => (int)PlayerSettings.Android.minSdkVersion >= 21,
                    () =>
                {
                    PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel21;
                    return(true);
                }),

                new PlayInstantSettingPolicy(
                    ".NET API Compatibility Level should be \".NET 2.0 Subset\"",
                    "This setting reduces APK size.",
                    () => PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Android) ==
                    ApiCompatibilityLevel.NET_2_0_Subset,
                    () =>
                {
                    PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Android,
                                                            ApiCompatibilityLevel.NET_2_0_Subset);
                    return(true);
                })
            };

            switch (PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android))
            {
            // This will reduce APK size, but may cause runtime issues if needed components are removed.
            // See https://docs.unity3d.com/Manual/IL2CPP-BytecodeStripping.html
            case ScriptingImplementation.IL2CPP:
                policies.Add(new PlayInstantSettingPolicy(
                                 "IL2CPP builds should strip engine code",
                                 "This setting reduces APK size, but may cause runtime issues.",
                                 () => PlayerSettings.stripEngineCode,
                                 () =>
                {
                    PlayerSettings.stripEngineCode = true;
                    return(true);
                }));

                break;

            case ScriptingImplementation.Mono2x:
                policies.Add(new PlayInstantSettingPolicy(
                                 "Mono builds should use the highest code stripping level (micro mscorlib)",
                                 "This setting reduces APK size.",
                                 () => PlayerSettings.strippingLevel == StrippingLevel.UseMicroMSCorlib,
                                 () =>
                {
                    PlayerSettings.strippingLevel = StrippingLevel.UseMicroMSCorlib;
                    return(true);
                }));
                break;
            }

            return(policies);
        }
Ejemplo n.º 15
0
        internal static string[] GetBuildingIL2CPPArguments(IIl2CppPlatformProvider il2cppPlatformProvider, BuildTargetGroup buildTargetGroup)
        {
            // When changing this function, don't forget to change GetBuilderDefinedDefines!
            var arguments             = new List <string>();
            var apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup);

            if (BuildPipeline.IsFeatureSupported("ENABLE_SCRIPTING_GC_WBARRIERS", il2cppPlatformProvider.target))
            {
                var hasGCBarrierValidation = PlayerSettings.gcWBarrierValidation;
                if (hasGCBarrierValidation)
                {
                    arguments.Add("--write-barrier-validation");
                }

                var hasIncrementalGCTimeSlice = PlayerSettings.gcIncremental && (apiCompatibilityLevel == ApiCompatibilityLevel.NET_4_6 || apiCompatibilityLevel == ApiCompatibilityLevel.NET_Standard_2_0);
                if (hasIncrementalGCTimeSlice)
                {
                    arguments.Add("--incremental-g-c-time-slice=3");
                }
            }

            arguments.Add("--profiler-report");

            return(arguments.ToArray());
        }
Ejemplo n.º 16
0
    public static void ConfigurePlayerSettings()
    {
        Debug.Log("Setting required PlayerSettings...");

        SetBuildTarget();

        // Needed for Microsoft.CSharp namespace in DLLMaker
        // Doesn't seem to work though
        if (PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup) != ApiCompatibilityLevel.NET_2_0)
        {
            PlayerSettings.SetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup, ApiCompatibilityLevel.NET_2_0);
        }

        if (!PlayerSettings.runInBackground)
        {
            PlayerSettings.runInBackground = true;
        }

#if !VRC_CLIENT
        // Не трогаем DLLки.
        // SetDLLPlatforms("VRCCore-Standalone", false);
        // SetDLLPlatforms("VRCCore-Editor", true);
#endif

        SetDefaultGraphicsAPIs();
        SetGraphicsSettings();
        SetAudioSettings();
        SetPlayerSettings();

#if VRC_CLIENT
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
#else
        // SDK

        // default to steam runtime in sdk (shouldn't matter)
        SetVRSDKs(EditorUserBuildSettings.selectedBuildTargetGroup, new string[] { "None", "OpenVR", "Oculus" });

        VRC.Core.AnalyticsSDK.Initialize(VRC.Core.SDKClientUtilities.GetSDKVersionDate());
#endif

        // VRCLog should handle disk writing
        PlayerSettings.usePlayerLog = false;
        if (EditorUserBuildSettings.selectedBuildTargetGroup != BuildTargetGroup.Standalone)
        {
            foreach (var logType in Enum.GetValues(typeof(LogType)).Cast <LogType>())
            {
                PlayerSettings.SetStackTraceLogType(logType, StackTraceLogType.None);
            }
        }
        else
        {
            foreach (var logType in Enum.GetValues(typeof(LogType)).Cast <LogType>())
            {
                PlayerSettings.SetStackTraceLogType(logType, StackTraceLogType.ScriptOnly);
            }
        }
    }
Ejemplo n.º 17
0
        public static void CheckAPICompatibility()
        {
            ApiCompatibilityLevel level = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone);

            if (level == ApiCompatibilityLevel.NET_2_0_Subset)
            {
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, ApiCompatibilityLevel.NET_2_0);
            }
        }
Ejemplo n.º 18
0
        private static void CheckAPICompatibility()
        {
            ApiCompatibilityLevel level = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone);

            if (level == ApiCompatibilityLevel.NET_2_0_Subset)
            {
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, ApiCompatibilityLevel.NET_2_0);
            }
            Helper.SetDefineSymbol(DEFINE_SYMBOLE_API_NET_TWO, true, true);
        }
    /// <summary>
    /// 預設IOS資料(取現在的PlayerSetting)
    /// </summary>
    private void DefaultSetIOS()
    {
        SDIOSSet aTmpSet = new SDIOSSet();

        // Resolution and Presentation
        aTmpSet.RequiresFullScreen             = PlayerSettings.iOS.requiresFullScreen;
        aTmpSet.StatusBarHidden                = PlayerSettings.statusBarHidden;
        aTmpSet.StatusBarStyle                 = PlayerSettings.iOS.statusBarStyle;
        aTmpSet.ShowActivityIndicatorOnLoading = PlayerSettings.iOS.showActivityIndicatorOnLoading;
        // Debugging and crash reporting
        aTmpSet.ActionOnDotNetUnhandledException = PlayerSettings.actionOnDotNetUnhandledException;
        aTmpSet.LogObjCUncaughtExceptions        = PlayerSettings.logObjCUncaughtExceptions;
        aTmpSet.EnableCrashReportAPI             = PlayerSettings.enableCrashReportAPI;
        // Identification
        aTmpSet.BundleIDIOS = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.iOS);
        aTmpSet.BuildNumber = PlayerSettings.iOS.buildNumber;
        aTmpSet.AppleEnableAutomaticSigning = PlayerSettings.iOS.appleEnableAutomaticSigning;
        aTmpSet.AppleDeveloperTeamID        = PlayerSettings.iOS.appleDeveloperTeamID;
        aTmpSet.ProvisioningProfileID       = PlayerSettings.iOS.iOSManualProvisioningProfileID;
        // Configuration
        aTmpSet.ScriptingBackend        = PlayerSettings.GetScriptingBackend(BuildTargetGroup.iOS);
        aTmpSet.ApiCompatibilityLevel   = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.iOS);
        aTmpSet.TargetDevice            = PlayerSettings.iOS.targetDevice;
        aTmpSet.SDKVersion              = PlayerSettings.iOS.sdkVersion;
        aTmpSet.TargetOSVersionString   = PlayerSettings.iOS.targetOSVersionString;
        aTmpSet.PrepareIOSForRecording  = SDDataMove.GetBoolPlayerSetting("Prepare IOS For Recording");
        aTmpSet.RequiresPersistentWiFi  = PlayerSettings.iOS.requiresPersistentWiFi;
        aTmpSet.AppInBackgroundBehavior = PlayerSettings.iOS.appInBackgroundBehavior;
        aTmpSet.Architecture            = PlayerSettings.GetArchitecture(BuildTargetGroup.iOS);
        // Optimization
        aTmpSet.ScriptCallOptimizationLevel = PlayerSettings.iOS.scriptCallOptimization;
        aTmpSet.StripEngineCode             = PlayerSettings.stripEngineCode;
        aTmpSet.StripLevel = PlayerSettings.strippingLevel;
        // Scripting Define Symbols
        aTmpSet.ScriptDefineSymblos = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS);
        // Icon
        aTmpSet.IconOverride = true;
        SDDataMove.GetIconsGroup(BuildTargetGroup.iOS, ref mUIUseImages.IosIcons, ref aTmpSet.DefIcons);
        aTmpSet.PrerenderedIcon = PlayerSettings.iOS.prerenderedIcon;
        // Splash Images
        int aEmumTotal = Enum.GetNames(typeof(eMobileSplashScreen)).Length;

        mUIUseImages.IOSSplashImages = new Texture2D[aEmumTotal];
        aTmpSet.SplashImages         = new string[aEmumTotal];
        for (int i = 0; i < aEmumTotal; i++)
        {
            aTmpSet.SplashImages[i] = SDDataMove.GetSplashScreenPath((eMobileSplashScreen)i, ref mUIUseImages.IOSSplashImages[i]);
        }
        //-------------------------------------------------
        // Unity5 New
        aTmpSet.GraphicsType = PlayerSettings.GetGraphicsAPIs(BuildTarget.iOS);
        // Set Down
        mShowSetInfo.IOSSet = aTmpSet;
    }
Ejemplo n.º 20
0
        void IApplyToTest.ApplyToTest(Test test)
        {
            test.Properties.Add(PropertyNames.Category, string.Format("ApiProfile({0})", string.Join(", ", apiProfiles.Select(p => p.ToString()).OrderBy(p => p).ToArray())));
            ApiCompatibilityLevel testProfile = PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.activeBuildTargetGroup);

            if (!apiProfiles.Contains(testProfile))
            {
                string skipReason = "Skipping test as it requires a compatible api profile set: " + string.Join(", ", apiProfiles.Select(p => p.ToString()).ToArray());
                test.RunState = RunState.Skipped;
                test.Properties.Add(PropertyNames.SkipReason, skipReason);
            }
        }
Ejemplo n.º 21
0
 private ScriptAssemblySettings CreateScriptAssemblySettings(BuildTargetGroup buildTargetGroup, BuildTarget buildTarget, EditorScriptCompilationOptions definesOptions)
 {
     string[] compilationDefines = InternalEditorUtility.GetCompilationDefines(definesOptions, buildTargetGroup, buildTarget);
     return(new ScriptAssemblySettings
     {
         BuildTarget = buildTarget,
         BuildTargetGroup = buildTargetGroup,
         OutputDirectory = EditorCompilation.EditorAssemblyPath,
         Defines = compilationDefines,
         ApiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(buildTargetGroup),
         FilenameSuffix = this.assemblySuffix
     });
 }
Ejemplo n.º 22
0
        // -------------------------------------------------------------------------------
        // SetBuildType
        // -------------------------------------------------------------------------------
        public static void SetBuildType(NetworkType buildType, bool headless = false)
        {
            ProjectConfigTemplate.singleton.networkType = buildType;
            ProjectConfigTemplate.singleton.OnValidate();

            EditorUserBuildSettings.enableHeadlessMode = headless;

            if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone) != ApiCompatibilityLevel.NET_4_6)
            {
                Debug.Log("<color=orange><b>OpenMMO requires .NET 4.x</b></color>\n<b>Changing to .NET 4.x</b>"); //DEBUG
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, ApiCompatibilityLevel.NET_4_6);
            }
        }
        private bool IsCompatibilitySet()
        {
#if UNITY_2017_1_OR_NEWER
            // Get current api setting
            ApiCompatibilityLevel level = PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup);

            // Check for accepted apis
            return(level == ApiCompatibilityLevel.NET_2_0 ||
                   level == ApiCompatibilityLevel.NET_4_6);
#else
            return(PlayerSettings.apiCompatibilityLevel == ApiCompatibilityLevel.NET_2_0);
#endif
        }
Ejemplo n.º 24
0
        public Framework RequireCurrentFramework()
        {
            Framework result = null !;

            ThreadHelper.RunInMainThread(() =>
            {
                var apiCompatibilityLevel =
                    PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup);
                result = new Framework(_frameworks[apiCompatibilityLevel]);
            });

            return(result);
        }
Ejemplo n.º 25
0
 public static void ShowNet20Notification()
 {
     //#if !NET_STANDARD_2_0 won't work since editor is always NET_4
     if (PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup) != ApiCompatibilityLevel.NET_4_6 &&
         EditorUtility.DisplayDialog("MapMagic API Compatibility Warning", "MapMagic requires .NET 4.x API Compatibility level. \n" +
                                     "Do you want to switch compatibility level now? \n\n" +
                                     "You can switch compatibility level manually in Project Settings -> Player -> Api Compatibility Level",
                                     "Switch to .NET 4.x",
                                     "Cancel"))
     {
         PlayerSettings.SetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup, ApiCompatibilityLevel.NET_4_6);
     }
 }
Ejemplo n.º 26
0
    private static MonoIsland CreateMonoIsland(SupportedLanguage language)
    {
        const string kInputFilePath     = "Packages/com.unity.inputsystem/InputSystem";
        var          outputAssemblyPath = Path.GetTempFileName();

        var options          = EditorScriptCompilationOptions.BuildingForEditor;
        var buildTarget      = UnityEditor.EditorUserBuildSettings.activeBuildTarget;
        var buildTargetGroup = UnityEditor.EditorUserBuildSettings.activeBuildTargetGroup;
        var defines          = ieu.GetCompilationDefines(options, buildTargetGroup, buildTarget);

        var references = new List <string>();

        references.Add(ieu.GetEngineAssemblyPath());
        references.Add(ieu.GetEngineCoreModuleAssemblyPath());
        references.Add(ieu.GetEditorAssemblyPath());
        references.AddRange(ModuleUtils.GetAdditionalReferencesForUserScripts());
#if UNITY_EDITOR_OSX
        references.Add(Path.Combine(EditorApplication.applicationContentsPath, "UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll"));
#elif UNITY_EDITOR_WIN
        references.Add(Path.Combine(Path.GetDirectoryName(EditorApplication.applicationPath), "Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll"));
#endif
        var unityAssemblies = InternalEditorUtility.GetUnityAssemblies(true, buildTargetGroup, buildTarget);
        foreach (var asm in unityAssemblies)
        {
            references.Add(asm.Path);
        }

        var apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.activeBuildTargetGroup);

        // Hopefully the churn on these mono library helpers is over, this is going to be a bit a pain to
        // always chase.
#if UNITY_2018_3_OR_NEWER && !(UNITY_2019_1_OR_NEWER)
        var scriptAssembly = new ScriptAssembly
        {
            Filename = AssetPath.GetFileName(outputAssemblyPath),
            Flags    = AssemblyFlags.None
        };
        references.AddRange(MonoLibraryHelpers.GetSystemLibraryReferences(apiCompatibilityLevel, buildTarget, language, true, scriptAssembly));
#elif UNITY_2019_1_OR_NEWER
        references.AddRange(MonoLibraryHelpers.GetSystemLibraryReferences(apiCompatibilityLevel, buildTarget, language));
#endif

        var sources = new List <string>();
        sources.AddRange(Directory.GetFiles(kInputFilePath, "*.cs", SearchOption.AllDirectories));

        var island = new MonoIsland(buildTarget, apiCompatibilityLevel, true, sources.ToArray(),
                                    references.ToArray(), defines, outputAssemblyPath);

        return(island);
    }
        private static void CheckScriptingRuntime()
        {
#if !UNITY_2019_3_OR_NEWER
            if (PlayerSettings.scriptingRuntimeVersion != ScriptingRuntimeVersion.Latest || PlayerSettings.GetApiCompatibilityLevel(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)) != ApiCompatibilityLevel.NET_4_6)
            {
                UpdateScriptingRuntime();
                return;
            }
#endif
            if (PlayerSettings.GetApiCompatibilityLevel(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)) != ApiCompatibilityLevel.NET_4_6)
            {
                UpdateScriptingRuntime();
            }
        }
Ejemplo n.º 28
0
        public static void Fix()
        {
#if UNITY_5_6_OR_NEWER
            if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone) != ApiCompatibilityLevel.NET_2_0)
            {
                PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, ApiCompatibilityLevel.NET_2_0);
            }
#else
            if (PlayerSettings.apiCompatibilityLevel != ApiCompatibilityLevel.NET_2_0)
            {
                PlayerSettings.apiCompatibilityLevel = ApiCompatibilityLevel.NET_2_0;
            }
#endif
        }
Ejemplo n.º 29
0
        public static List <string> GetStaticSearchPaths(BuildTarget buildTarget)
        {
            var unityAssembliesInternal =
                EditorCompilationInterface.Instance.PrecompiledAssemblyProvider.GetUnityAssemblies(true, buildTarget);
            var namedBuildTarget           = NamedBuildTarget.FromActiveSettings(buildTarget);
            var systemReferenceDirectories =
                MonoLibraryHelpers.GetSystemReferenceDirectories(
                    PlayerSettings.GetApiCompatibilityLevel(namedBuildTarget));

            var searchPaths = unityAssembliesInternal.Select(x => Path.GetDirectoryName(x.Path))
                              .Distinct().ToList();

            searchPaths.AddRange(systemReferenceDirectories);
            return(searchPaths);
        }
Ejemplo n.º 30
0
    static bool PlayerCheck()
    {
        bool isApply = true;

        if (PlayerSettings.Android.minSdkVersion < AndroidSdkVersions.AndroidApiLevel26)
        {
            isApply = false;
        }
        if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Android) != ApiCompatibilityLevel.NET_4_6)
        {
            isApply = false;
        }
        if (PlayerSettings.GetMobileMTRendering(BuildTargetGroup.Android) == true)
        {
            isApply = false;
        }

        UnityEngine.Rendering.GraphicsDeviceType[] gapi = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android);

        if (gapi.Length != 1 || gapi[0] != UnityEngine.Rendering.GraphicsDeviceType.OpenGLES3)
        {
            isApply = false;
        }

        if (PlayerSettings.defaultInterfaceOrientation != UIOrientation.LandscapeLeft)
        {
            isApply = false;
        }

        if (EditorSettings.serializationMode != SerializationMode.ForceText)
        {
            isApply = false;
        }

        int        staticBatchingValue  = 0;
        int        dynamicBatchingValue = 0;
        Type       playerSettingsType   = typeof(PlayerSettings);
        MethodInfo method = playerSettingsType.GetMethod("GetBatchingForPlatform", BindingFlags.NonPublic | BindingFlags.Static);

        object[] param = new object[] { BuildTarget.Android, staticBatchingValue, dynamicBatchingValue };
        method.Invoke(null, param);
        if ((int)param[2] != 1)
        {
            isApply = false;
        }

        return(isApply);
    }