using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.Universal; using UnityEngine.UIElements; namespace BITKit { public class SetRenderScale : Provider { public UniversalRenderPipelineAsset asset; public override float Get() { return asset.renderScale; } public override void Set(float t) { asset.renderScale = t; } } #if UNITY_EDITOR [UnityEditor.CustomEditor(typeof(SetRenderScale))] public class SetRenderScaleInspector : BITInspector { public override VisualElement CreateInspectorGUI() { FillDefaultInspector(root, serializedObject, true); var slider = root.Create(); slider.SetValueWithoutNotify(agent.asset.renderScale); slider.label = "渲染倍数"; slider.showInputField=true; slider.RegisterValueChangedCallback(OnValueUpdate); return root; } void OnValueUpdate(ChangeEvent newValueEvent) { BITAppForUnity.ThrowIfNotPlaying(); agent.Set(newValueEvent.newValue); } } #endif }