From 2a0998acc1e2fd26630f49e4352cb4a14cfda6bb Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:06 +0000 Subject: [PATCH 01/34] [Port] [6000.2] Fix Android glitch by using a different overload for SetRenderTarget --- .../Runtime/Passes/FinalBlitPass.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs index d70a8ee62ba..b9b5190f735 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs @@ -212,7 +212,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData loadAction = RenderBufferLoadAction.Load; #endif - CoreUtils.SetRenderTarget(renderingData.commandBuffer, cameraTargetHandle, loadAction, RenderBufferStoreAction.Store, ClearFlag.None, Color.clear); + CoreUtils.SetRenderTarget(renderingData.commandBuffer, cameraTargetHandle.nameID, loadAction, RenderBufferStoreAction.Store, ClearFlag.None, Color.clear); ExecutePass(CommandBufferHelpers.GetRasterCommandBuffer(renderingData.commandBuffer), m_PassData, m_Source, cameraTargetHandle, cameraData); cameraData.renderer.ConfigureCameraTarget(cameraTargetHandle, cameraTargetHandle); } From 824a2a7f3d3a3d836cb34c828487614088ed67ad Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:06 +0000 Subject: [PATCH 02/34] [Port] [6000.2] [VFX] Fixed an error message because of the node search on macOS --- .../Editor/FilterPopup/VFXFilterWindow.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs index a4f6213c725..3a20442301c 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs @@ -301,6 +301,7 @@ private void CreateGUI() private void OnFirstDisplay(GeometryChangedEvent geometryChangedEvent) { + m_Parent.window.m_DontSaveToLayout = true; rootVisualElement.UnregisterCallback(OnFirstDisplay); UpdateDetailsPanelVisibility(); } From 3e48f9cc7b80ba04d160e0e8feceb70c2e8cf396 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:06 +0000 Subject: [PATCH 03/34] [Port] [6000.2] [VFX] HLSL compilation issue with comments --- .../Models/Blocks/Implementations/HLSL/CustomHLSL.cs | 8 ++++---- .../Models/Blocks/Implementations/HLSL/HLSLParser.cs | 9 --------- .../Models/Operators/Implementations/CustomHLSL.cs | 8 ++++---- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs index 9feb7426f1f..0f3a82ca75a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs @@ -305,10 +305,10 @@ private void ParseCodeIfNeeded() } var hasError = m_Function?.errorList.Count > 0; - var strippedHLSL = HLSLParser.StripCommentedCode(GetHLSLCode()); - if (hasError || strippedHLSL != cachedHLSLCode || m_SelectedFunction != m_AvailableFunction.GetSelection() || m_AvailableFunction.values == null) + var hlslCode = GetHLSLCode(); + if (hasError || hlslCode != cachedHLSLCode || m_SelectedFunction != m_AvailableFunction.GetSelection() || m_AvailableFunction.values == null) { - var functions = new List(HLSLFunction.Parse(graph.attributesManager, strippedHLSL)); + var functions = new List(HLSLFunction.Parse(graph.attributesManager, hlslCode)); if (functions.Count > 0) { @@ -363,7 +363,7 @@ private void ParseCodeIfNeeded() m_AvailableFunction = new MultipleValuesChoice() { values = new List() }; } - cachedHLSLCode = strippedHLSL; + cachedHLSLCode = hlslCode; } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs index b9a1afd360c..384308aac45 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs @@ -531,8 +531,6 @@ private static Dictionary ComputeKnownTypes() }; static readonly Regex s_IncludeParser = new Regex(@"^#include ""(?.*)""", RegexOptions.Compiled | RegexOptions.Multiline); - static readonly Regex s_MultilineCommentsParser = new Regex(@"/\*[\s\S]*?\*/", RegexOptions.Compiled|RegexOptions.Multiline); - static readonly Regex s_SinglelineCommentsParser = new Regex(@"^\s*/{2}[^/].*$", RegexOptions.Compiled|RegexOptions.Multiline|RegexOptions.IgnorePatternWhitespace); public static Type HLSLToUnityType(string type) { @@ -565,12 +563,5 @@ public static IEnumerable ParseIncludes(string hlsl) yield return ((Match)include).Groups["filepath"].Value; } } - - public static string StripCommentedCode(string hlsl) - { - return string.IsNullOrEmpty(hlsl) - ? string.Empty - : s_SinglelineCommentsParser.Replace(s_MultilineCommentsParser.Replace(hlsl, string.Empty), string.Empty); - } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs index 1ed69775f98..2c7ce57705a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs @@ -357,10 +357,10 @@ private void ParseCodeIfNeeded() } var hasError = m_Function?.errorList.Count > 0; - var strippedHLSL = HLSLParser.StripCommentedCode(GetHLSLCode()); - if (hasError || strippedHLSL != cachedHLSLCode || m_SelectedFunction != m_AvailableFunctions.GetSelection() || m_AvailableFunctions.values == null) + var hlslCode = GetHLSLCode(); + if (hasError || hlslCode != cachedHLSLCode || m_SelectedFunction != m_AvailableFunctions.GetSelection() || m_AvailableFunctions.values == null) { - var functions = new List(HLSLFunction.Parse(graph.attributesManager, strippedHLSL)); + var functions = new List(HLSLFunction.Parse(graph.attributesManager, hlslCode)); if (functions.Count > 0) { @@ -431,7 +431,7 @@ private void ParseCodeIfNeeded() m_OutputProperties = new List(); } - cachedHLSLCode = strippedHLSL; + cachedHLSLCode = hlslCode; } } From a20049ee9d28425910016f6134988e1f493268a6 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:06 +0000 Subject: [PATCH 04/34] [Port] [6000.2] [VFX] Avoid an exception when creating a new VFX asset from a template using the + button --- .../Editor/GraphView/Views/VFXView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index 83d28de57ae..631fa11d23f 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -1799,7 +1799,8 @@ public void CreateNewFromTemplate(string templatePath, string assetPath) VisualEffectAssetEditorUtility.CreateTemplateAsset(assetPath, templatePath); var vfxAsset = AssetDatabase.LoadAssetAtPath(assetPath); var window = VFXViewWindow.GetWindow(vfxAsset, false); - window.LoadAsset(vfxAsset, null); + // The window can be null if we try to create a new asset from an editor window with another asset opened + window?.LoadAsset(vfxAsset, null); } public void CreateTemplateSystem(string path, Vector2 tPos, VFXGroupNode groupNode, bool centerInView) From baedfe355ff773ed4d65987cfcd4c2616850b414 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:07 +0000 Subject: [PATCH 05/34] [Port] [6000.2] Fix unselectable None option in Rendering Debugger > Volume > Camera --- .../Editor/Debugging/DebugState.cs | 29 +++++++++++++++ .../Debugging/DebugDisplaySettingsVolumes.cs | 28 ++++++--------- .../Debug/DebugDisplaySettingsCamera.cs | 35 ++++++------------- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs index 2e72da47421..c9dafbe881b 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugState.cs @@ -182,6 +182,35 @@ public sealed class DebugStateInt : DebugState { } [Serializable, DebugState(typeof(DebugUI.ObjectPopupField), typeof(DebugUI.CameraSelector), typeof(DebugUI.ObjectField))] public sealed class DebugStateObject : DebugState { + [SerializeField] string m_UserData; + + /// + public override void SetValue(object value, DebugUI.IValueField field) + { + // DebugStateObject is used to serialize the selected camera reference in DebugUI.CameraSelector. For SceneView Camera this doesn't work because + // the camera is never saved and always recreated. So we use a special string to identify this case and restore the reference later. + if (field is DebugUI.CameraSelector && SceneView.lastActiveSceneView != null && (Camera)value == SceneView.lastActiveSceneView.camera) + { + m_UserData = "SceneViewCamera"; + } + else + { + m_UserData = null; + } + base.SetValue(value, field); + } + + /// + public override object GetValue() + { + if (value == null && m_UserData != null && m_UserData == "SceneViewCamera" && SceneView.lastActiveSceneView != null && SceneView.lastActiveSceneView.camera != null) + { + value = SceneView.lastActiveSceneView.camera; + } + + return base.GetValue(); + } + /// /// Returns the hash code of the Debug Item. /// diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs index 87296a7fb0e..74a13be298b 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsVolumes.cs @@ -59,23 +59,10 @@ public Type selectedComponentType /// Current camera to debug. public Camera selectedCamera { - get - { -#if UNITY_EDITOR - // By default pick the one scene camera - if (m_SelectedCamera == null && SceneView.lastActiveSceneView != null) - { - var sceneCamera = SceneView.lastActiveSceneView.camera; - if (sceneCamera != null) - m_SelectedCamera = sceneCamera; - } -#endif - - return m_SelectedCamera; - } + get => m_SelectedCamera; set { - if (value != null && value != m_SelectedCamera) + if (value != m_SelectedCamera) { m_SelectedCamera = value; OnSelectionChanged(); @@ -333,7 +320,7 @@ public static DebugUI.EnumField CreateComponentSelector(SettingsPanel panel, Act }; } - public static DebugUI.ObjectPopupField CreateCameraSelector(SettingsPanel panel, Action, Object> refresh) + public static DebugUI.CameraSelector CreateCameraSelector(SettingsPanel panel, Action, Object> refresh) { return new DebugUI.CameraSelector() { @@ -708,7 +695,14 @@ public override void Dispose() public SettingsPanel(DebugDisplaySettingsVolume data) : base(data) { - AddWidget(WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh())); + var cameraSelector = WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh()); + + // Select first camera if none is selected + var availableCameras = cameraSelector.getObjects() as List; + if (data.selectedCamera == null && availableCameras is { Count: > 0 }) + data.selectedCamera = availableCameras[0]; + + AddWidget(cameraSelector); AddWidget(WidgetFactory.CreateComponentSelector(this, (_, __) => Refresh())); Func hiddenCallback = () => data.selectedCamera == null || data.selectedComponent <= 0; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs index 46509f724a9..d84ccbe9e4c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplaySettingsCamera.cs @@ -10,29 +10,8 @@ class DebugDisplaySettingsCamera : IDebugDisplaySettingsData [Serializable] public class FrameSettingsDebugData { - private Camera m_SelectedCamera; - public Camera selectedCamera - { - get - { -#if UNITY_EDITOR - if (m_SelectedCamera == null && UnityEditor.SceneView.lastActiveSceneView != null) - { - var sceneCamera = UnityEditor.SceneView.lastActiveSceneView.camera; - if (sceneCamera != null) - m_SelectedCamera = sceneCamera; - } -#endif - return m_SelectedCamera; - } - set - { - if (value != null && value != m_SelectedCamera) - { - m_SelectedCamera = value; - } - } - } + public Camera selectedCamera { get; set; } + public Dictionary registeredCameras = new (); } @@ -98,8 +77,8 @@ public static DebugUI.CameraSelector CreateCameraSelector(SettingsPanel panel, getter = () => panel.data.frameSettingsData.selectedCamera, setter = value => { - if (value is Camera cam && value != panel.data.frameSettingsData.selectedCamera) - panel.data.frameSettingsData.selectedCamera = cam; + if (value != panel.data.frameSettingsData.selectedCamera) + panel.data.frameSettingsData.selectedCamera = value as Camera; }, onValueChanged = refresh }; @@ -134,6 +113,12 @@ public SettingsPanel(DebugDisplaySettingsCamera data) : base(data) { m_CameraSelector = WidgetFactory.CreateCameraSelector(this, (_, __) => Refresh()); + + // Select first camera if none is selected + var availableCameras = m_CameraSelector.getObjects() as List; + if (data.frameSettingsData.selectedCamera == null && availableCameras is { Count: > 0 }) + data.frameSettingsData.selectedCamera = availableCameras[0]; + AddWidget(m_CameraSelector); if (GetOrCreateFrameSettingsWidgets(out var frameSettingsWidgets)) From 9d268eea676ae33012dd1693698eff3abdc1c7a3 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:07 +0000 Subject: [PATCH 06/34] [Port] [6000.2] docg-7282: Add Matrix Data types --- .../Documentation~/Property-Types.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md index 94e50de03fb..f6a40dd9de9 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md +++ b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md @@ -185,3 +185,27 @@ Defines a **Boolean** value. Displays a **ToggleUI** field in the material inspe | Field | Type | Description | |:-------------|:------|:------------| | Default | Boolean | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | + +## Matrix 2x2 + +Defines a Matrix 2. Matrices do not display in the **Inspector** window of the material. + +| Field | Type | +|:--------|:---------| +| Default | Matrix 2 | + +## Matrix 3x3 + +Defines a Matrix 3 value. Can't be displayed in the material inspector. + +| Field | Type | +|:--------|:---------| +| Default | Matrix 3 | + +## Matrix 4x4 + +Defines a Matrix 4 value. Can't be displayed in the material inspector. + +| Field | Type | +|:--------|:---------| +| Default | Matrix 4 | From dd2ca26013c64494b1de02bde0e93a2cd2d34f17 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:07 +0000 Subject: [PATCH 07/34] [Port] [6000.2] [VFX] Forbid dragging a subgraph block onto the graph directly, only allow on compatible contexts --- .../Editor/GraphView/Views/VFXView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index 631fa11d23f..11e178914b0 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -3162,6 +3162,7 @@ internal DragAndDropVisualMode GetDragAndDropModeForVisualEffectObject(VisualEff if (visualEffectObject != null && visualEffectObject != controller.model.visualEffectObject) { var isOperator = visualEffectObject is VisualEffectSubgraphOperator; + var isBlock = visualEffectObject is VisualEffectSubgraphBlock; var graph = visualEffectObject.GetResource().GetOrCreateGraph(); graph.BuildSubgraphDependencies(); var draggedObjectDependencies = graph.subgraphDependencies; @@ -3172,7 +3173,7 @@ internal DragAndDropVisualMode GetDragAndDropModeForVisualEffectObject(VisualEff return DragAndDropVisualMode.Rejected; } - var vfxIntoVfx = !isOperator && !controller.model.isSubgraph; // dropping a vfx into a vfx + var vfxIntoVfx = !isOperator && !isBlock && !controller.model.isSubgraph; // dropping a vfx into a vfx return vfxIntoVfx || isOperator ? DragAndDropVisualMode.Move @@ -3299,13 +3300,12 @@ void OnDragPerform(DragPerformEvent e) { VFXContextType contextKind = subgraphBlock.GetResource().GetOrCreateGraph().children.OfType().First().compatibleContextType; VFXModelDescriptor contextType = VFXLibrary.GetContexts().First(t => t.modelType == typeof(VFXBasicInitialize)); - var model = (VFXContext)contextType.CreateInstance(); if ((contextKind & VFXContextType.Update) == VFXContextType.Update) contextType = VFXLibrary.GetContexts().First(t => t.modelType == typeof(VFXBasicUpdate)); else if ((contextKind & VFXContextType.Spawner) == VFXContextType.Spawner) contextType = VFXLibrary.GetContexts().First(t => t.modelType == typeof(VFXBasicSpawner)); else if ((contextKind & VFXContextType.Output) == VFXContextType.Output) - contextType = VFXLibrary.GetContexts().First(t => t.modelType == typeof(VFXPlanarPrimitiveOutput) && model.taskType == VFXTaskType.ParticleQuadOutput); + contextType = VFXLibrary.GetContexts().First(t => t.modelType == typeof(VFXPlanarPrimitiveOutput) && t.model.taskType == VFXTaskType.ParticleQuadOutput); UpdateSelectionWithNewNode(); VFXContext ctx = controller.AddVFXContext(mousePosition, contextType.variant); From 8364f883fb61b750752ad2cace3a8289a4399227 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:07 +0000 Subject: [PATCH 08/34] [Port] [6000.2] [VFX] Properly support \r special character in custom hlsl tooltip comments --- .../Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs | 4 ++-- .../Assets/AllTests/Editor/Tests/HLSLParserTest.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs index 384308aac45..7a899b59f1a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/HLSLParser.cs @@ -73,7 +73,7 @@ public HLSLUnknownParameterType(string type) public string message { get; } public VFXErrorType type => VFXErrorType.Error; } - + class HLSLUnsupportedAttributes : IHLSMessage { public HLSLUnsupportedAttributes(IEnumerable attributesName) @@ -321,7 +321,7 @@ private Dictionary GetDoc(string rawDoc) foreach (var m in s_DocParser.Matches(rawDoc)) { var match = (Match)m; - doc[match.Groups["parameter"].Value] = match.Groups["tooltip"].Value; + doc[match.Groups["parameter"].Value] = match.Groups["tooltip"].Value.TrimEnd('\n', '\r'); } return doc; diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/HLSLParserTest.cs b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/HLSLParserTest.cs index f0c55853d67..25a1c2898c0 100644 --- a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/HLSLParserTest.cs +++ b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/HLSLParserTest.cs @@ -159,7 +159,7 @@ public void HLSL_Check_Parameter_Documentation_Type() // Arrange var hlslCode = "/// offset: this is the offset" + "\n" + - "/// speedFactor: this is the speedFactor" + "\n" + + "/// speedFactor: this is the speedFactor" + "\r\n" + "void CustomHLSL(inout VFXAttributes attributes, in float3 offset, in float speedFactor)" + "\n" + "{" + "\n" + " attributes.position += offset;" + "\n" + From dcb3d89ec050f40cb1797b6dc27133bf905e9083 Mon Sep 17 00:00:00 2001 From: Reach Platform Support Date: Thu, 2 Oct 2025 12:06:07 +0000 Subject: [PATCH 09/34] [Port] [6000.2] [VFX] Avoid DPI warning message in the console --- .../GraphView/Elements/VFXEditableDataAnchor.cs | 12 +++++------- .../Editor/GraphView/Views/Properties/PropertyRM.cs | 2 +- .../Editor/UIResources/uss/VFXDataAnchor.uss | 8 ++++++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEditableDataAnchor.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEditableDataAnchor.cs index 6ffd238ce17..6ef79568cd3 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEditableDataAnchor.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXEditableDataAnchor.cs @@ -39,7 +39,7 @@ protected VFXEditableDataAnchor(Orientation anchorOrientation, Direction anchorD public void AssetMoved() { - m_PropertyRM.UpdateGUI(true); + m_PropertyRM?.UpdateGUI(true); } public override void BuildContextualMenu(ContextualMenuPopulateEvent evt) @@ -86,24 +86,22 @@ void OnDetachFromPanel(DetachFromPanelEvent e) public float GetPreferredLabelWidth() { - if (m_PropertyRM == null) return 0; - return m_PropertyRM.GetPreferredLabelWidth(); + return m_PropertyRM?.GetPreferredLabelWidth() ?? 0; } public float GetPreferredControlWidth() { - if (m_PropertyRM == null) return 0; - return m_PropertyRM.GetPreferredControlWidth(); + return m_PropertyRM?.GetPreferredControlWidth() ?? 0; } public void SetLabelWidth(float label) { - m_PropertyRM.SetLabelWidth(label); + m_PropertyRM?.SetLabelWidth(label); } public void ForceUpdate() { - m_PropertyRM.ForceUpdate(); + m_PropertyRM?.ForceUpdate(); } void BuildProperty() diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs index 3ed93216154..0370c9cbb9a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/PropertyRM.cs @@ -153,7 +153,7 @@ public virtual bool IsCompatible(IPropertyRMProvider provider) public float GetPreferredLabelWidth() { - if (hasLabel && this.Q