private void DrawIcon() { var totalIcons = PlayerSettings.GetIconsForTargetGroup(BuildTargetGroup.Unknown); Texture2D icon = totalIcons.FirstOrDefault(); EditorGUI.BeginChangeCheck(); var newIcon = EditorGUIExtensions.TextureField("Default Icon", icon); if (EditorGUI.EndChangeCheck()) { if (totalIcons.Length <= 0) { totalIcons = new Texture2D[] { newIcon }; } else { totalIcons[0] = newIcon; } PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown, totalIcons); } if (_settings.SelectedPreferences.icon.Required && newIcon == null) { EditorGUILayout.HelpBox("App has no icon.", MessageType.Warning); } }
private void DrawScriptingBackend(BuildTargetGroup buildTargetGroup) { EditorGUI.BeginChangeCheck(); var value = (ScriptingImplementation)EditorGUILayout.EnumPopup("Scripting Backend", PlayerSettings.GetScriptingBackend(buildTargetGroup)); if (EditorGUI.EndChangeCheck()) { PlayerSettings.SetScriptingBackend(buildTargetGroup, value); } ScriptingImplementation prefSI; switch (buildTargetGroup) { case BuildTargetGroup.Android: prefSI = _settings.SelectedPreferences.android.scriptingImplementation; break; case BuildTargetGroup.iOS: prefSI = _settings.SelectedPreferences.iOS.scriptingImplementation; break; default: return; } if (value != prefSI && EditorGUIExtensions.DrawFixHelpBox($"Incorrect scripting backend on {buildTargetGroup.ToString()}")) { PlayerSettings.SetScriptingBackend(buildTargetGroup, prefSI); } }
private void DrawIOSPreferences() { EditorGUIExtensions.DrawHeader("iOS"); DrawScriptingImplementationIOS(); DrawAppleTeamId(); DrawAutomaticallySign(); }
private void DrawPlatformButtons() { EditorGUIExtensions.DrawHeader("Platform settings"); GUILayout.BeginHorizontal(); DrawPlatformButton(BuildTarget.Android); DrawPlatformButton(BuildTarget.iOS); GUILayout.EndHorizontal(); }
private void DrawAndroidPreferences() { EditorGUIExtensions.DrawHeader("Android"); DrawMinAPIVersion(); DrawTargetAPIVersion(); DrawArchitecturesAndroid(); DrawScriptingImplementationAndroid(); DrawSplitAPKs(); DrawManifestIsDebuggable(); }
private void DrawManifestInfo() { EditorGUIExtensions.DrawHeader("Android Manifest Settings"); if (ManifestUtility.HasManifest()) { DrawIsDebuggable(); } else { EditorGUILayout.HelpBox("AndroidManifest.xml doesn't exist.", MessageType.Warning); } }
private void DrawSharedSettings() { EditorGUIExtensions.DrawHeader("Application"); DrawProWarning(); DrawAppName(); DrawCompany(); DrawVersion(); DrawIcon(); EditorGUIExtensions.DrawHeader("Splash screen"); DrawSplashLogos(); DrawSplashBackgroundColor(); EditorGUIExtensions.DrawHeader("Orientation"); DrawOrientationMode(); }
private void DrawSDKs() { for (int i = 0; i < _target.SDKs.Count; i++) { var sdk = _target.SDKs[i]; EditorGUI.BeginChangeCheck(); bool removed; EditorGUILayout.BeginHorizontal(); var newSDK = (SDKBuildPreferences)EditorGUILayout.ObjectField(sdk, typeof(SDKBuildPreferences), false); removed = GUILayout.Button("Remove"); EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_target, "Edited Build Preferences"); _target.SDKs[i] = newSDK; } if (removed) { Undo.RecordObject(_target, "Edited Build Preferences"); _target.SDKs.RemoveAt(i); i--; continue; } if (newSDK) { EditorGUIExtensions.DrawHeader(newSDK.ItemName); newSDK.DrawPreferences(); } } if (GUILayout.Button("Add SDK")) { Undo.RecordObject(_target, "Edited Build Preferences"); _target.SDKs.Add(null); } }
private void DrawSplashLogos() { var logos = _target.splash.logos; for (int i = 0; i < logos.Count; i++) { var logo = logos[i]; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); var newLogo = EditorGUIExtensions.SpriteField($"Logo {i}", logo); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_target, "Edited Build Preferences"); logos[i] = newLogo; } if (!newLogo) { EditorGUILayout.HelpBox("Logo is null", MessageType.Warning); } if (GUILayout.Button("Remove")) { Undo.RecordObject(_target, "Edited Build Preferences"); logos.RemoveAt(i--); } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Add logo")) { Undo.RecordObject(_target, "Edited Build Preferences"); logos.Add(null); } if ((logos == null || logos.Count <= 0)) { EditorGUILayout.HelpBox("No logos defined.", MessageType.Warning); } }
private void DrawTargetSDK() { EditorGUI.BeginChangeCheck(); var code = EditorGUILayout.IntSlider("Target SDK Version", (int)PlayerSettings.Android.targetSdkVersion, 16, 30); if (EditorGUI.EndChangeCheck()) { PlayerSettings.Android.targetSdkVersion = (AndroidSdkVersions)code; } if (code != _settings.SelectedPreferences.android.targetApiVersionInt && EditorGUIExtensions.DrawFixHelpBox("Mismatching target API version")) { PlayerSettings.Android.targetSdkVersion = (AndroidSdkVersions)_settings.SelectedPreferences.android.targetApiVersionInt; } }
private void DrawIsDebuggable() { EditorGUI.BeginChangeCheck(); var debuggable = EditorGUILayout.Toggle("Is debuggable", ManifestUtility.IsDebuggable()); if (EditorGUI.EndChangeCheck()) { ManifestUtility.SetDebuggableValue(debuggable); } if (_settings.SelectedPreferences.android.manifestPreferences.debuggable != debuggable && EditorGUIExtensions.DrawFixHelpBox("Is debuggable is incorrect")) { ManifestUtility.SetDebuggableValue(_settings.SelectedPreferences.android.manifestPreferences.debuggable); } }
private void DrawSDKsSettings() { foreach (var sdk in _settings.SelectedPreferences.SDKs) { if (sdk != null) { EditorGUIExtensions.DrawHeader(sdk.ItemName); sdk.DrawComparsion(); if (sdk.HasInternalSettings && GUILayout.Button("Open SDK settings")) { sdk.OpenInternalSettings(); } } } }
private void DrawSigningTeamId() { EditorGUI.BeginChangeCheck(); var id = EditorGUILayout.TextField("Developer Team Id", PlayerSettings.iOS.appleDeveloperTeamID); if (EditorGUI.EndChangeCheck()) { PlayerSettings.iOS.appleDeveloperTeamID = id; } if (_settings.SelectedPreferences.iOS.signingTeamId != id && EditorGUIExtensions.DrawFixHelpBox("Incorrect team ID")) { PlayerSettings.iOS.appleDeveloperTeamID = _settings.SelectedPreferences.iOS.signingTeamId; } }
private void DrawAutomaticallySign() { EditorGUI.BeginChangeCheck(); var value = EditorGUILayout.Toggle("Automatically Sign", PlayerSettings.iOS.appleEnableAutomaticSigning); if (EditorGUI.EndChangeCheck()) { PlayerSettings.iOS.appleEnableAutomaticSigning = value; } if (_settings.SelectedPreferences.iOS.automaticallySign != value && EditorGUIExtensions.DrawFixHelpBox("Automatically sign value is incorrect")) { PlayerSettings.iOS.appleEnableAutomaticSigning = _settings.SelectedPreferences.iOS.automaticallySign; } }
private void DrawSplashBackgroundColor() { EditorGUI.BeginChangeCheck(); var newColor = EditorGUILayout.ColorField("Splash Screen Background Color", PlayerSettings.SplashScreen.backgroundColor); if (EditorGUI.EndChangeCheck()) { PlayerSettings.SplashScreen.backgroundColor = newColor; } if (_settings.SelectedPreferences.splash.Required && _settings.SelectedPreferences.splash.backgroundColor != PlayerSettings.SplashScreen.backgroundColor && EditorGUIExtensions.DrawFixHelpBox("Incorrect Splash Background Color.")) { PlayerSettings.SplashScreen.backgroundColor = _settings.SelectedPreferences.splash.backgroundColor; } }
private void DrawCompany() { EditorGUI.BeginChangeCheck(); var value = EditorGUILayout.TextField("Company", PlayerSettings.companyName); if (EditorGUI.EndChangeCheck()) { PlayerSettings.companyName = value; } if (_settings.SelectedPreferences.company.Required && _settings.SelectedPreferences.company.name != value && EditorGUIExtensions.DrawFixHelpBox("Company name doesn't match with preferences.")) { PlayerSettings.companyName = _settings.SelectedPreferences.company.name; } }
private bool DrawRequirable(Requirable requirable) { EditorGUI.BeginChangeCheck(); EditorGUIExtensions.DrawHeader(requirable.ItemName); var value = EditorGUILayout.Toggle("Required", requirable.Required); EditorGUILayout.Space(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_target, "Edited Build Preferences"); requirable.Required = value; } return(value); }
private void DrawBuildType() { EditorGUI.BeginChangeCheck(); var prefType = (BuildPreferencesType)EditorGUILayout.EnumPopup("Build Type", _settings.selectedPrefType); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_settings, "Edited Build Preferences"); _settings.selectedPrefType = prefType; } if (prefType != BuildPreferencesType.Release && EditorGUIExtensions.DrawFixHelpBox("Selected non-release build type.", "Switch to release")) { Undo.RecordObject(_settings, "Edited Build Preferences"); _settings.selectedPrefType = BuildPreferencesType.Release; } }
private void DrawSplashLogos() { var logos = PlayerSettings.SplashScreen.logos.ToList(); for (int i = 0; i < logos.Count; i++) { var logo = logos[i]; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); var newLogo = EditorGUIExtensions.SpriteField($"Logo {i}", logo.logo); if (_settings.SelectedPreferences.splash.Required && !_settings.SelectedPreferences.splash.logos.Contains(logo.logo)) { EditorGUILayout.HelpBox("This logo wasn't expected by preferences.", MessageType.Warning); } if (EditorGUI.EndChangeCheck()) { logo.logo = newLogo; logos[i] = logo; PlayerSettings.SplashScreen.logos = logos.ToArray(); } if (GUILayout.Button("Remove")) { logos.RemoveAt(i--); PlayerSettings.SplashScreen.logos = logos.ToArray(); } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Add logo")) { logos.Add(new PlayerSettings.SplashScreenLogo()); PlayerSettings.SplashScreen.logos = logos.ToArray(); } foreach (var prefLogo in _settings.SelectedPreferences.splash.logos) { if (prefLogo == null) { continue; } bool found = false; foreach (var existingLogo in logos) { if (existingLogo.logo == prefLogo) { found = true; } } if (!found) { if (_settings.SelectedPreferences.splash.Required && EditorGUIExtensions.DrawFixHelpBox($"Logo {prefLogo.name} wasn't added.")) { var newLogo = new PlayerSettings.SplashScreenLogo(); newLogo.logo = prefLogo; logos.Add(newLogo); PlayerSettings.SplashScreen.logos = logos.ToArray(); } } } if (_settings.SelectedPreferences.splash.Required && (logos == null || logos.Count <= 0)) { EditorGUILayout.HelpBox("App has logos.", MessageType.Warning); } }
private void DrawOwnSettings() { EditorGUIExtensions.DrawHeader("Internal"); DrawBuildType(); DrawLinkToPreferences(); }
private void DrawOrientationMode() { EditorGUI.BeginChangeCheck(); var orientation = (UIOrientation)EditorGUILayout.EnumPopup("Default orientation", PlayerSettings.defaultInterfaceOrientation); if (EditorGUI.EndChangeCheck()) { PlayerSettings.defaultInterfaceOrientation = orientation; } if (orientation != _settings.SelectedPreferences.deviceOrientation.Orientation && EditorGUIExtensions.DrawFixHelpBox($"Incorrect device orientation. It should be {_settings.SelectedPreferences.deviceOrientation.Orientation}")) { PlayerSettings.defaultInterfaceOrientation = _settings.SelectedPreferences.deviceOrientation.Orientation; } if (orientation == UIOrientation.AutoRotation) { EditorGUI.BeginChangeCheck(); var leftRot = EditorGUILayout.Toggle("Landscape Left", PlayerSettings.allowedAutorotateToLandscapeLeft); if (EditorGUI.EndChangeCheck()) { PlayerSettings.allowedAutorotateToLandscapeLeft = leftRot; } if (_settings.SelectedPreferences.deviceOrientation.AutoRotation) { if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.LandscapeLeft)) { if (PlayerSettings.allowedAutorotateToLandscapeLeft && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable")) { PlayerSettings.allowedAutorotateToLandscapeLeft = false; } } else { if (!PlayerSettings.allowedAutorotateToLandscapeLeft && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable")) { PlayerSettings.allowedAutorotateToLandscapeLeft = true; } } } EditorGUI.BeginChangeCheck(); var rightRot = EditorGUILayout.Toggle("Landscape Right", PlayerSettings.allowedAutorotateToLandscapeRight); if (EditorGUI.EndChangeCheck()) { PlayerSettings.allowedAutorotateToLandscapeRight = rightRot; } if (_settings.SelectedPreferences.deviceOrientation.AutoRotation) { if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.LandscapeRight)) { if (PlayerSettings.allowedAutorotateToLandscapeRight && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable")) { PlayerSettings.allowedAutorotateToLandscapeRight = false; } } else { if (!PlayerSettings.allowedAutorotateToLandscapeRight && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable")) { PlayerSettings.allowedAutorotateToLandscapeRight = true; } } } EditorGUI.BeginChangeCheck(); var portrait = EditorGUILayout.Toggle("Portrait", PlayerSettings.allowedAutorotateToPortrait); if (EditorGUI.EndChangeCheck()) { PlayerSettings.allowedAutorotateToPortrait = portrait; } if (_settings.SelectedPreferences.deviceOrientation.AutoRotation) { if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.Portrait)) { if (PlayerSettings.allowedAutorotateToPortrait && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable")) { PlayerSettings.allowedAutorotateToPortrait = false; } } else { if (!PlayerSettings.allowedAutorotateToPortrait && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable")) { PlayerSettings.allowedAutorotateToPortrait = true; } } } EditorGUI.BeginChangeCheck(); var portraitUpsideDown = EditorGUILayout.Toggle("Portrait Upside Down", PlayerSettings.allowedAutorotateToPortraitUpsideDown); if (EditorGUI.EndChangeCheck()) { PlayerSettings.allowedAutorotateToPortraitUpsideDown = portraitUpsideDown; } if (_settings.SelectedPreferences.deviceOrientation.AutoRotation) { if (!_settings.SelectedPreferences.deviceOrientation.allowed.Contains(UIOrientation.PortraitUpsideDown)) { if (PlayerSettings.allowedAutorotateToPortraitUpsideDown && EditorGUIExtensions.DrawFixHelpBox("Unexpected orientation", "Disable")) { PlayerSettings.allowedAutorotateToPortraitUpsideDown = false; } } else { if (!PlayerSettings.allowedAutorotateToPortraitUpsideDown && EditorGUIExtensions.DrawFixHelpBox("Missing orientation", "Enable")) { PlayerSettings.allowedAutorotateToPortraitUpsideDown = true; } } } } }