From fb7440ee7706871d0685359e1775b65545fe329c Mon Sep 17 00:00:00 2001 From: Paul Demeulenaere Date: Tue, 3 Nov 2020 18:26:40 +0100 Subject: [PATCH] [VFX] Remove Exact Fixed Time option (#2507) * Remove temporarily "Exact Fixed Time Step" option on VisualEffectAsset to avoid unexpected behavior * Use santize instead of inspector behavior to remove ExactFixedTimeStep Actually, doesn't break editor test because Sanitize is only call on the first import (or opening the graph). --- .../Assets/AllTests/Editor/Tests/VFXSpawnerTest.cs | 2 ++ com.unity.visualeffectgraph/CHANGELOG.md | 1 + .../Editor/Inspector/VFXAssetEditor.cs | 4 ++++ com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs | 8 ++++++++ 4 files changed, 15 insertions(+) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSpawnerTest.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSpawnerTest.cs index 6b3ba15fa30..9d3e56bc364 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSpawnerTest.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXSpawnerTest.cs @@ -341,6 +341,7 @@ public IEnumerator Create_Spawner_Check_Time_Mode_Update_Count([ValueSource("s_C graph.GetResource().updateMode = (VFXUpdateMode)timeMode.vfxUpdateMode; AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graph)); + Assert.AreEqual(graph.GetResource().updateMode, (VFXUpdateMode)timeMode.vfxUpdateMode); var previousCaptureFrameRate = Time.captureFramerate; var previousFixedTimeStep = UnityEngine.VFX.VFXManager.fixedTimeStep; @@ -398,6 +399,7 @@ public IEnumerator Change_Fixed_Time_Step_To_A_Large_Value_Then_Back_To_Default( CreateAssetAndComponent(3615.0f, "OnPlay", out graph, out vfxComponent, out gameObj, out cameraObj); graph.GetResource().updateMode = (VFXUpdateMode)timeMode.vfxUpdateMode; AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graph)); + Assert.AreEqual(graph.GetResource().updateMode, (VFXUpdateMode)timeMode.vfxUpdateMode); var previousCaptureFrameRate = Time.captureFramerate; var previousFixedTimeStep = UnityEngine.VFX.VFXManager.fixedTimeStep; diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 435e329db10..45583361485 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed Random Vector subgraph utility operator in Additional Samples - Fixed Set Strip Progress Attribute utility block in Additional Samples - Fix [Case 1255182](https://fogbugz.unity3d.com/f/cases/1255182/) +- Remove temporarily "Exact Fixed Time Step" option on VisualEffectAsset to avoid unexpected behavior ## [10.1.0] - 2020-10-12 ### Added diff --git a/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs b/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs index 9e2bbdc7784..d4ebecb5c59 100644 --- a/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs +++ b/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs @@ -457,7 +457,11 @@ public override void OnInspectorGUI() bool newExactFixedTimeStep = false; EditorGUI.showMixedValue = !initialProcessEveryFrame.HasValue; EditorGUI.BeginDisabledGroup((!initialFixedDeltaTime.HasValue || !initialFixedDeltaTime.Value) && !resourceUpdateModeProperty.hasMultipleDifferentValues); + +#if CASE_1289829_HAS_BEEN_FIXED newExactFixedTimeStep = EditorGUILayout.Toggle(processEveryFrameContent, initialProcessEveryFrame ?? false); +#endif + EditorGUI.EndDisabledGroup(); EditorGUI.showMixedValue = !initialIgnoreGameTimeScale.HasValue; bool newIgnoreTimeScale = EditorGUILayout.Toggle(ignoreTimeScaleContent, initialIgnoreGameTimeScale ?? false); diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 616d65ffdac..eec15d5687f 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -415,6 +415,14 @@ public void SanitizeGraph() m_GraphSanitized = true; m_GraphVersion = CurrentVersion; +#if !CASE_1289829_HAS_BEEN_FIXED + if (visualEffectResource != null && (visualEffectResource.updateMode & VFXUpdateMode.ExactFixedTimeStep) == VFXUpdateMode.ExactFixedTimeStep) + { + visualEffectResource.updateMode = visualEffectResource.updateMode & ~VFXUpdateMode.ExactFixedTimeStep; + Debug.Log("Sanitize : Exact Fixed Time has been automatically reset to false to avoid an unexpected behavior."); + } +#endif + UpdateSubAssets(); //Should not be necessary : force remove no more referenced object from asset }