public void SliderChange(VisualSetting setting, float floatValue) //Used when using a UI slider { int value = (int)floatValue; if (value < 0) { throw new System.ArgumentOutOfRangeException(); } foreach (var property in typeof(QualitySettings).GetTypeInfo().GetProperties()) { if (property.ToString().ToLower().Contains(setting.ToString().ToLower())) { property.SetValue(null, value); return; } } }
public void ToggleChange(VisualSetting setting) //Used when using a UI toggle. { foreach (var property in typeof(QualitySettings).GetTypeInfo().GetProperties()) { if (property.ToString().ToLower().Contains(setting.ToString().ToLower())) { if (property.PropertyType.Name == "Boolean") { property.SetValue(null, toggle.isOn); } else if (toggle.isOn) //Handles numerical values { property.SetValue(null, enabledToggleValue); } else { property.SetValue(null, 0); } return; } } }
public void OnDrawGizmos() { #if UNITY_EDITOR Handles.Label(this.transform.position, QualitySetting.ToString(), GUI.skin.button); #endif }