float OtherGroup(float xStart, float yStart) { float xPos = xStart + 25; float yPos = yStart + 25; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), EUtils.UnityColoredText("Other", headingColor)); yPos = yPos + sWidthHeight.y; //vSync GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "vSync: " + QualitySettings.vSyncCount); vSync = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), vSync, 0, maxvSync); QualitySettings.vSyncCount = (int)vSync; yPos = yPos + sWidthHeight.y; //End vSync GUI.Label(new Rect(xPos, yPos, sWidthHeight.x + 100, sWidthHeight.y), "Limit frame rate only works when vSync is disabled(0)"); yPos = yPos + sWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Frame rate (0 = unlimited): " + Application.targetFrameRate); frameRate = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), frameRate, 0, maxFrameRate); Application.targetFrameRate = (int)frameRate; yPos = yPos + sWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Particle Raycast Budget: " + QualitySettings.particleRaycastBudget); particleRaycastBudget = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), particleRaycastBudget, 0, maxParticleRaycastBudget); particleRaycastBudget = (int)Mathf.ClosestPowerOfTwo((int)particleRaycastBudget); if (particleRaycastBudget < 4) { particleRaycastBudget = 4; } QualitySettings.particleRaycastBudget = (int)Mathf.ClosestPowerOfTwo((int)particleRaycastBudget); return(yPos); }
float ShadowGroup(float xStart, float yStart) { float xPos = xStart + 25; float yPos = yStart + 25; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), EUtils.UnityColoredText("Shadow", headingColor)); yPos = yPos + sWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Projection: " + QualitySettings.shadowProjection.ToString()); yPos = yPos + sWidthHeight.y; if (GUI.Button(new Rect(xPos, yPos, bWidthHeight.x, bWidthHeight.y), ShadowProjection.CloseFit.ToString())) { shadowProjection = ShadowProjection.CloseFit; } if (GUI.Button(new Rect(xPos + bWidthHeight.x, yPos, bWidthHeight.x, bWidthHeight.y), ShadowProjection.StableFit.ToString())) { shadowProjection = ShadowProjection.StableFit; } QualitySettings.shadowProjection = shadowProjection; yPos = yPos + bWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Distance: " + QualitySettings.shadowDistance); shadowDistance = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), shadowDistance, 0, maxShadowDistance); QualitySettings.shadowDistance = shadowDistance; yPos = yPos + sWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Shadow Cascade: " + QualitySettings.shadowCascades); shadowCascade = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), shadowCascade, 0, maxShadowCascade); shadowCascade = (int)Mathf.ClosestPowerOfTwo((int)shadowCascade); if (shadowCascade == 1) { shadowCascade = 0; } QualitySettings.shadowCascades = (int)Mathf.ClosestPowerOfTwo((int)shadowCascade); return(yPos); }
float RenderingGroup(float xStart, float yStart) { float xPos = xStart + 25; float yPos = yStart + 25; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), EUtils.UnityColoredText("Rendering", headingColor)); yPos = yPos + sWidthHeight.y; //Anti Analysing GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Antialiasing: " + QualitySettings.antiAliasing); antiAliasing = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), antiAliasing, 0, maxAntiAliasing); if (antiAliasing != QualitySettings.antiAliasing) { antiAliasing = (int)Mathf.ClosestPowerOfTwo((int)antiAliasing); if (antiAliasing == 1) { antiAliasing = 0; } QualitySettings.antiAliasing = (int)Mathf.ClosestPowerOfTwo((int)antiAliasing); } //End anti Analysing //Anisotropic Filtering yPos = yPos + sWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Anisotropic Filtering: " + QualitySettings.anisotropicFiltering.ToString()); yPos = yPos + sWidthHeight.y; if (GUI.Button(new Rect(xPos, yPos, bWidthHeight.x, bWidthHeight.y), AnisotropicFiltering.Disable.ToString())) { anisotropicFilt = AnisotropicFiltering.Disable; } if (GUI.Button(new Rect(xPos + bWidthHeight.x, yPos, bWidthHeight.x, bWidthHeight.y), AnisotropicFiltering.Enable.ToString())) { anisotropicFilt = AnisotropicFiltering.Enable; } if (GUI.Button(new Rect(xPos + (bWidthHeight.x * 2), yPos, bWidthHeight.x, bWidthHeight.y), AnisotropicFiltering.ForceEnable.ToString())) { anisotropicFilt = AnisotropicFiltering.ForceEnable; } QualitySettings.anisotropicFiltering = anisotropicFilt; //End Anisotropic Filtering //Texture Quality yPos = yPos + bWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Texture Quality(Beter to worse): " + QualitySettings.masterTextureLimit); textureQuality = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, 25), textureQuality, 0, maxTextureQuality); QualitySettings.masterTextureLimit = (int)textureQuality; //End Texture Quality //Pixel Light Count yPos = yPos + sWidthHeight.y; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Pixel Light Count: " + QualitySettings.pixelLightCount); pixelLightCount = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), pixelLightCount, 0, maxPixelLightCount); QualitySettings.pixelLightCount = (int)pixelLightCount; //End Pixel Light Count return(yPos); }
float SoundGroup(float xStart, float yStart) { float xPos = xStart + 25; float yPos = yStart + 25; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), EUtils.UnityColoredText("Sound", headingColor)); yPos = yPos + sWidthHeight.y; //masterVolume GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), "Master Volume: " + (int)(AudioListener.volume * 100)); masterVolume = GUI.HorizontalSlider(new Rect(xPos + sWidthHeight.x, yPos, sWidthHeight.x, sWidthHeight.y), masterVolume, 0, maxMasterVolume); AudioListener.volume = masterVolume / 100; return(yPos); }
float ResolutionGroup(float xStart, float yStart) { float xPos = xStart + 25; float yPos = yStart + 25; GUI.Label(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), EUtils.UnityColoredText("Resolutions", headingColor)); yPos = yPos + sWidthHeight.y; fullScreen = GUI.Toggle(new Rect(xPos, yPos, sWidthHeight.x, sWidthHeight.y), fullScreen, "Full screen"); yPos = yPos + sWidthHeight.y; float maxHeight = yPos + (Mathf.Floor(Screen.resolutions.Length / 3) * (sWidthHeight.y)); Resolution[] resolutions = Screen.resolutions; for (int i = 0; i < resolutions.Length; i++) { float newXPos = xPos + (i % 3) * (bWidthHeight.x); float newYPos = yPos + (Mathf.Floor(i / 3) * (bWidthHeight.y)); if (GUI.Button(new Rect(newXPos, newYPos, bWidthHeight.x, bWidthHeight.y), resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate)) { Screen.SetResolution(resolutions[i].width, resolutions[i].height, fullScreen, resolutions[i].refreshRate); #if UNITY_WEBPLAYER //var unity = document.getElementById('unityPlayer'); Application.ExternalEval("config.width = " + resolutions[i].width + ";" + "config.height = " + resolutions[i].height + ";" + "document.getElementById('unityPlayer').style.width = '" + resolutions[i].width + "px';" + "document.getElementById('unityPlayer').style.height = '" + resolutions[i].height + "px';" + "document.getElementsByTagName('embed')[0].width = '" + resolutions[i].width + "px';" + "document.getElementsByTagName('embed')[0].height = '" + resolutions[i].height + "px';" + "document.getElementsByTagName('embed')[0].style.width = '" + resolutions[i].width + "px';" + "document.getElementsByTagName('embed')[0].style.height = '" + resolutions[i].height + "px';" + "document.getElementsByClassName('content')[0].style.width = '" + resolutions[i].width + "px';" ); #endif optionWindowRect.x = 0; optionWindowRect.y = 0; } } return(maxHeight); }