diff --git a/CHANGELOG.md b/CHANGELOG.md index 1902e91..2b6d314 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.10.0] 2023.09.18 + +### Added +- Aggressively inline `static` methods for minor performance boost. + +### Changed +- Updated dependencies: + - `"com.unity.entities": "1.0.16"` + - `"com.unity.burst": "1.8.8"` + - `"com.unity.entities.graphics": "1.0.16"` + ## [0.9.1] 2023.07.31 ### Fixed diff --git a/README.md b/README.md index 540cd15..4d60760 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,10 @@ ### Updated to Unity 2022.3 LTS -Tweening library for Unity ECS/DOTS 1.0.11 -Now uses Entities Graphics library from Unity. -Developed on `2022.3.5f1`, in case you were wondering :) +Tweening library for Unity ECS/DOTS +Updated for Entities 1.0.16 +Uses Entities Graphics library from Unity. +Developed on `2022.3.9f1`, in case you were wondering :) ## Table of Contents @@ -114,10 +115,10 @@ Developed on `2022.3.5f1`, in case you were wondering :) ```json "dependencies": { "com.unity.collections": "2.1.4", - "com.unity.entities": "1.0.11", - "com.unity.burst": "1.8.7", + "com.unity.entities": "1.0.16", + "com.unity.burst": "1.8.8", "com.unity.mathematics": "1.2.6", - "com.unity.entities.graphics": "1.0.11" + "com.unity.entities.graphics": "1.0.16" } ``` diff --git a/Runtime/Math/EasingFunctions.cs b/Runtime/Math/EasingFunctions.cs index 0c47a1c..a214d7a 100644 --- a/Runtime/Math/EasingFunctions.cs +++ b/Runtime/Math/EasingFunctions.cs @@ -1,4 +1,5 @@ -using Unity.Burst; +using System.Runtime.CompilerServices; +using Unity.Burst; using Unity.Mathematics; namespace DotsTween.Math @@ -14,39 +15,40 @@ public static class EasingFunctions private const float C4 = (2f * math.PI) / 3f; private const float C5 = (2f * math.PI) / 4.5f; - private static float Linear(float x) { return x; } - private static float InQuad(float x) { return x * x; } - private static float OutQuad(float x) { return 1f - (1f - x) * (1f - x); } - private static float InOutQuad(float x) { return x < 0.5f ? 2f * x * x : 1f - math.pow(-2f * x + 2f, 2f) / 2f; } - private static float InCubic(float x) { return x * x * x; } - private static float OutCubic(float x) { return 1 - math.pow(1 - x, 3); } - private static float InOutCubic(float x) { return x < 0.5 ? 4 * x * x * x : 1 - math.pow(-2 * x + 2, 3) / 2; } - private static float InQuart(float x) { return x * x * x * x; } - private static float OutQuart(float x) { return 1f - math.pow(1f - x, 4f); } - private static float InOutQuart(float x) { return x < 0.5f ? 8f * x * x * x * x : 1f - math.pow(-2f * x + 2f, 4f) / 2f; } - private static float InQuint(float x) { return x * x * x * x * x; } - private static float OutQuint(float x) { return 1f - math.pow(1f - x, 5f); } - private static float InOutQuint(float x) { return x < 0.5f ? 16f * x * x * x * x * x : 1 - math.pow(-2f * x + 2f, 5f) / 2f; } - private static float InSine(float x) { return 1f - math.cos((x * math.PI) / 2f); } - private static float OutSine(float x) { return math.sin((x * math.PI) / 2f); } - private static float InOutSine(float x) { return -(math.cos(math.PI * x) - 1f) / 2f; } - private static float InExpo(float x) { return x <= 0f ? 0f : math.pow(2f, 10f * x - 10f); } - private static float OutExpo(float x) { return x >= 1f ? 1f : 1f - math.pow(2f, -10f * x); } - private static float InOutExpo(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : x < 0.5f ? math.pow(2f, 20f * x - 10f) / 2f : (2f - math.pow(2f, -20f * x + 10f)) / 2f; } - private static float InCirc(float x) { return 1f - math.sqrt(1f - math.pow(x, 2f)); } - private static float OutCirc(float x) { return math.sqrt(1f - math.pow(x - 1f, 2f)); } - private static float InOutCirc(float x) { return x < 0.5f ? (1f - math.sqrt(1f - math.pow(2f * x, 2f))) / 2f : (math.sqrt(1f - math.pow(-2f * x + 2f, 2f)) + 1f) / 2f; } - private static float InBack(float x) { return C3 * x * x * x - C1 * x * x; } - private static float OutBack(float x) { return 1f + C3 * math.pow(x - 1f, 3f) + C1 * math.pow(x - 1f, 2f); } - private static float InOutBack(float x) { return x < 0.5f ? (math.pow(2f * x, 2f) * ((C2 + 1f) * 2f * x - C2)) / 2f : (math.pow(2f * x - 2f, 2f) * ((C2 + 1f) * (x * 2f - 2f) + C2) + 2f) / 2f; } - private static float InElastic(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : -math.pow(2f, 10f * x - 10f) * math.sin((x * 10f - 10.75f) * C4); } - private static float OutElastic(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : math.pow(2f, -10f * x) * math.sin((x * 10f - 0.75f) * C4) + 1f; } - private static float InOutElastic(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : x < 0.5f ? -(math.pow(2f, 20f * x - 10f) * math.sin((20f * x - 11.125f) * C5)) / 2 : (math.pow(2f, -20f * x + 10f) * math.sin((20f * x - 11.125f) * C5)) / 2f + 1f; } - private static float InBounce(float x) { return 1 - InterpolateOutBounceStatic(1 - x); } - private static float OutBounce(float x) { return InterpolateOutBounceStatic(x); } - private static float InOutBounce(float x) { return x < 0.5f ? (1f - InterpolateOutBounceStatic(1f - 2f * x)) / 2f : (1f + InterpolateOutBounceStatic(2f * x - 1f)) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float Linear(float x) { return x; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InQuad(float x) { return x * x; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutQuad(float x) { return 1f - (1f - x) * (1f - x); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutQuad(float x) { return x < 0.5f ? 2f * x * x : 1f - math.pow(-2f * x + 2f, 2f) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InCubic(float x) { return x * x * x; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutCubic(float x) { return 1 - math.pow(1 - x, 3); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutCubic(float x) { return x < 0.5 ? 4 * x * x * x : 1 - math.pow(-2 * x + 2, 3) / 2; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InQuart(float x) { return x * x * x * x; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutQuart(float x) { return 1f - math.pow(1f - x, 4f); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutQuart(float x) { return x < 0.5f ? 8f * x * x * x * x : 1f - math.pow(-2f * x + 2f, 4f) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InQuint(float x) { return x * x * x * x * x; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutQuint(float x) { return 1f - math.pow(1f - x, 5f); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutQuint(float x) { return x < 0.5f ? 16f * x * x * x * x * x : 1 - math.pow(-2f * x + 2f, 5f) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InSine(float x) { return 1f - math.cos((x * math.PI) / 2f); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutSine(float x) { return math.sin((x * math.PI) / 2f); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutSine(float x) { return -(math.cos(math.PI * x) - 1f) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InExpo(float x) { return x <= 0f ? 0f : math.pow(2f, 10f * x - 10f); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutExpo(float x) { return x >= 1f ? 1f : 1f - math.pow(2f, -10f * x); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutExpo(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : x < 0.5f ? math.pow(2f, 20f * x - 10f) / 2f : (2f - math.pow(2f, -20f * x + 10f)) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InCirc(float x) { return 1f - math.sqrt(1f - math.pow(x, 2f)); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutCirc(float x) { return math.sqrt(1f - math.pow(x - 1f, 2f)); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutCirc(float x) { return x < 0.5f ? (1f - math.sqrt(1f - math.pow(2f * x, 2f))) / 2f : (math.sqrt(1f - math.pow(-2f * x + 2f, 2f)) + 1f) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InBack(float x) { return C3 * x * x * x - C1 * x * x; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutBack(float x) { return 1f + C3 * math.pow(x - 1f, 3f) + C1 * math.pow(x - 1f, 2f); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutBack(float x) { return x < 0.5f ? (math.pow(2f * x, 2f) * ((C2 + 1f) * 2f * x - C2)) / 2f : (math.pow(2f * x - 2f, 2f) * ((C2 + 1f) * (x * 2f - 2f) + C2) + 2f) / 2f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InElastic(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : -math.pow(2f, 10f * x - 10f) * math.sin((x * 10f - 10.75f) * C4); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutElastic(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : math.pow(2f, -10f * x) * math.sin((x * 10f - 0.75f) * C4) + 1f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutElastic(float x) { return x <= 0f ? 0f : x >= 1f ? 1f : x < 0.5f ? -(math.pow(2f, 20f * x - 10f) * math.sin((20f * x - 11.125f) * C5)) / 2 : (math.pow(2f, -20f * x + 10f) * math.sin((20f * x - 11.125f) * C5)) / 2f + 1f; } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InBounce(float x) { return 1 - InterpolateOutBounceStatic(1 - x); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float OutBounce(float x) { return InterpolateOutBounceStatic(x); } + [BurstCompile] [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InOutBounce(float x) { return x < 0.5f ? (1f - InterpolateOutBounceStatic(1f - 2f * x)) / 2f : (1f + InterpolateOutBounceStatic(2f * x - 1f)) / 2f; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float InterpolateOutBounceStatic(float x) { switch (x) @@ -71,6 +73,7 @@ private static float InterpolateOutBounceStatic(float x) } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static float Ease(EaseType easeType, float t) { return easeType switch diff --git a/Runtime/Math/Extensions.cs b/Runtime/Math/Extensions.cs index 1145543..241c305 100644 --- a/Runtime/Math/Extensions.cs +++ b/Runtime/Math/Extensions.cs @@ -1,13 +1,18 @@ -using Unity.Mathematics; +using System.Runtime.CompilerServices; +using Unity.Burst; +using Unity.Mathematics; using UnityEngine; namespace DotsTween.Math { + [BurstCompile] internal static class Extensions { - public static float4 ToFloat4(this Color color) + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ToFloat4(in this Color color, out float4 f4) { - return new float4(color.r, color.g, color.b, color.a); + f4 = new float4(color.r, color.g, color.b, color.a); } /// @@ -15,9 +20,11 @@ public static float4 ToFloat4(this Color color) /// /// /// - public static float3 ToFloat3(this Color color) + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ToFloat3(in this Color color, out float3 f3) { - return new float3(color.r, color.g, color.b); + f3 = new float3(color.r, color.g, color.b); } } } \ No newline at end of file diff --git a/Runtime/Static/HDRP/Tween.HDRP.AlphaCutoff.cs b/Runtime/Static/HDRP/Tween.HDRP.AlphaCutoff.cs index c4e5c7e..bee5a46 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.AlphaCutoff.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.AlphaCutoff.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class AlphaCutoff { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAlphaCutoffCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAlphaCutoffCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAlphaCutoffCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMax.cs b/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMax.cs index f20e66c..7ca0d09 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMax.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMax.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class AmbientOcclusionRemapMax { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAmbientOcclusionRemapMaxCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAmbientOcclusionRemapMaxCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAmbientOcclusionRemapMaxCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMin.cs b/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMin.cs index ee2d6ec..732e4cb 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMin.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.AmbientOcclusionRemapMin.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class AmbientOcclusionRemapMin { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAmbientOcclusionRemapMinCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAmbientOcclusionRemapMinCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPAmbientOcclusionRemapMinCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.DetailAlbedoScale.cs b/Runtime/Static/HDRP/Tween.HDRP.DetailAlbedoScale.cs index 6f37b72..719bf6a 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.DetailAlbedoScale.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.DetailAlbedoScale.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class DetailAlbedoScale { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailAlbedoScaleCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailAlbedoScaleCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailAlbedoScaleCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.DetailNormalScale.cs b/Runtime/Static/HDRP/Tween.HDRP.DetailNormalScale.cs index a3b4ccc..da5a21b 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.DetailNormalScale.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.DetailNormalScale.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class DetailNormalScale { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailNormalScaleCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailNormalScaleCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailNormalScaleCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.DetailSmoothnessScale.cs b/Runtime/Static/HDRP/Tween.HDRP.DetailSmoothnessScale.cs index 64aafed..6693b62 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.DetailSmoothnessScale.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.DetailSmoothnessScale.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class DetailSmoothnessScale { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailSmoothnessScaleCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailSmoothnessScaleCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDetailSmoothnessScaleCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.DiffusionProfileHash.cs b/Runtime/Static/HDRP/Tween.HDRP.DiffusionProfileHash.cs index 9fecb0d..5c8b984 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.DiffusionProfileHash.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.DiffusionProfileHash.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class DiffusionProfileHash { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDiffusionProfileHashCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDiffusionProfileHashCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPDiffusionProfileHashCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.EmissiveColor.cs b/Runtime/Static/HDRP/Tween.HDRP.EmissiveColor.cs index 72134c3..c33a90e 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.EmissiveColor.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.EmissiveColor.cs @@ -6,6 +6,7 @@ using Unity.Mathematics; using Unity.Rendering; using UnityEngine; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -18,6 +19,7 @@ public static class EmissiveColor { #region float4 [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPEmissiveColorCommand(entity, start.xyz, end.xyz, duration, tweenParams); @@ -26,6 +28,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float4 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPEmissiveColorCommand(entity, start.xyz, end.xyz, duration, tweenParams); @@ -34,6 +37,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPEmissiveColorCommand(entity, start.xyz, end.xyz, duration, tweenParams); @@ -42,6 +46,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -49,6 +54,7 @@ public static uint To(ref SystemState state, in Entity entity, in float4 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -56,6 +62,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -63,6 +70,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -70,6 +78,7 @@ public static uint From(ref SystemState state, in Entity entity, in float4 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -77,6 +86,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -86,6 +96,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW #region float3 [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPEmissiveColorCommand(entity, start, end, duration, tweenParams); @@ -94,6 +105,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float3 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPEmissiveColorCommand(entity, start, end, duration, tweenParams); @@ -102,6 +114,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPEmissiveColorCommand(entity, start, end, duration, tweenParams); @@ -110,6 +123,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -117,6 +131,7 @@ public static uint To(ref SystemState state, in Entity entity, in float3 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -124,6 +139,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -131,6 +147,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -138,6 +155,7 @@ public static uint From(ref SystemState state, in Entity entity, in float3 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -145,6 +163,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -154,73 +173,95 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW #region Color [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPEmissiveColorCommand(entity, start.ToFloat3(), end.ToFloat3(), duration, tweenParams); + start.ToFloat3(out var startColour); + end.ToFloat3(out var endColour); + var command = new TweenHDRPEmissiveColorCommand(entity, startColour, endColour, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPEmissiveColorCommand(entity, start.ToFloat3(), end.ToFloat3(), duration, tweenParams); + start.ToFloat3(out var startColour); + end.ToFloat3(out var endColour); + var command = new TweenHDRPEmissiveColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPEmissiveColorCommand(entity, start.ToFloat3(), end.ToFloat3(), duration, tweenParams); + start.ToFloat3(out var startColour); + end.ToFloat3(out var endColour); + var command = new TweenHDRPEmissiveColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat3(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat3(), duration, tweenParams); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat3(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat3(), duration, tweenParams); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat3(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat3(), duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat3(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat3(), end, duration, tweenParams); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat3(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat3(), end, duration, tweenParams); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat3(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat3(), end, duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); } #endregion [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float3 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.Fade.cs b/Runtime/Static/HDRP/Tween.HDRP.Fade.cs index 176a780..c827e2f 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.Fade.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.Fade.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class Fade { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPFadeCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPFadeCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPFadeCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value.w; diff --git a/Runtime/Static/HDRP/Tween.HDRP.FadeUnlit.cs b/Runtime/Static/HDRP/Tween.HDRP.FadeUnlit.cs index 67124e3..f3a2c39 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.FadeUnlit.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.FadeUnlit.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class FadeUnlit { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPFadeUnlitCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPFadeUnlitCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPFadeUnlitCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value.w; diff --git a/Runtime/Static/HDRP/Tween.HDRP.Metallic.cs b/Runtime/Static/HDRP/Tween.HDRP.Metallic.cs index 5af4e2e..15a0b6e 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.Metallic.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.Metallic.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class Metallic { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPMetallicCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPMetallicCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPMetallicCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.Smoothness.cs b/Runtime/Static/HDRP/Tween.HDRP.Smoothness.cs index c7ac5a6..04f1e50 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.Smoothness.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.Smoothness.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class Smoothness { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMax.cs b/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMax.cs index 7d29e23..7f4d0d8 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMax.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMax.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class SmoothnessRemapMax { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessRemapMaxCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessRemapMaxCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessRemapMaxCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMin.cs b/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMin.cs index 494257f..c433113 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMin.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.SmoothnessRemapMin.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class SmoothnessRemapMin { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessRemapMinCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessRemapMinCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSmoothnessRemapMinCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.SpecularColor.cs b/Runtime/Static/HDRP/Tween.HDRP.SpecularColor.cs index 8f9de70..708221d 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.SpecularColor.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.SpecularColor.cs @@ -6,6 +6,7 @@ using Unity.Mathematics; using Unity.Rendering; using UnityEngine; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -17,6 +18,7 @@ public static partial class HDRP public static class SpecularColor { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSpecularColorCommand(entity, start, end, duration, tweenParams); @@ -25,6 +27,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float4 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSpecularColorCommand(entity, start, end, duration, tweenParams); @@ -33,6 +36,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPSpecularColorCommand(entity, start, end, duration, tweenParams); @@ -41,6 +45,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -48,6 +53,7 @@ public static uint To(ref SystemState state, in Entity entity, in float4 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -55,6 +61,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -62,6 +69,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -69,6 +77,7 @@ public static uint From(ref SystemState state, in Entity entity, in float4 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -76,6 +85,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -83,72 +93,94 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPSpecularColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPSpecularColorCommand(entity, startColour, endColour, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPSpecularColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPSpecularColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPSpecularColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPSpecularColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.Thickness.cs b/Runtime/Static/HDRP/Tween.HDRP.Thickness.cs index bdddb66..14f9c8b 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.Thickness.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.Thickness.cs @@ -4,6 +4,7 @@ using Unity.Entities; using Unity.Rendering; using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,6 +16,7 @@ public static partial class HDRP public static class Thickness { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPThicknessCommand(entity, start, end, duration, tweenParams); @@ -23,6 +25,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPThicknessCommand(entity, start, end, duration, tweenParams); @@ -31,6 +34,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPThicknessCommand(entity, start, end, duration, tweenParams); @@ -39,6 +43,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -46,6 +51,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -53,6 +59,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -60,6 +67,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -67,6 +75,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -74,6 +83,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -81,6 +91,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.ThicknessRemap.cs b/Runtime/Static/HDRP/Tween.HDRP.ThicknessRemap.cs index b16ffb7..a3d5280 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.ThicknessRemap.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.ThicknessRemap.cs @@ -6,6 +6,7 @@ using Unity.Mathematics; using Unity.Rendering; using UnityEngine; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -17,6 +18,7 @@ public static partial class HDRP public static class ThicknessRemap { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPThicknessRemapCommand(entity, start, end, duration, tweenParams); @@ -25,6 +27,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float4 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPThicknessRemapCommand(entity, start, end, duration, tweenParams); @@ -33,6 +36,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPThicknessRemapCommand(entity, start, end, duration, tweenParams); @@ -41,6 +45,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -48,6 +53,7 @@ public static uint To(ref SystemState state, in Entity entity, in float4 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -55,6 +61,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -62,6 +69,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -69,6 +77,7 @@ public static uint From(ref SystemState state, in Entity entity, in float4 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -76,6 +85,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -83,72 +93,94 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPThicknessRemapCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPThicknessRemapCommand(entity, startColour, endColour, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPThicknessRemapCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPThicknessRemapCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPThicknessRemapCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPThicknessRemapCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.Tint.cs b/Runtime/Static/HDRP/Tween.HDRP.Tint.cs index 52b6022..edbfe12 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.Tint.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.Tint.cs @@ -6,6 +6,7 @@ using Unity.Mathematics; using Unity.Rendering; using UnityEngine; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -17,6 +18,7 @@ public static partial class HDRP public static class Tint { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPTintCommand(entity, start, end, duration, tweenParams); @@ -25,6 +27,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float4 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPTintCommand(entity, start, end, duration, tweenParams); @@ -33,6 +36,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPTintCommand(entity, start, end, duration, tweenParams); @@ -41,6 +45,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -48,6 +53,7 @@ public static uint To(ref SystemState state, in Entity entity, in float4 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -55,6 +61,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -62,6 +69,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -69,6 +77,7 @@ public static uint From(ref SystemState state, in Entity entity, in float4 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -76,6 +85,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -83,72 +93,94 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPTintCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPTintCommand(entity, startColour, endColour, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPTintCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPTintCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPTintCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPTintCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/HDRP/Tween.HDRP.TintUnlit.cs b/Runtime/Static/HDRP/Tween.HDRP.TintUnlit.cs index 0e6c7bd..084896b 100644 --- a/Runtime/Static/HDRP/Tween.HDRP.TintUnlit.cs +++ b/Runtime/Static/HDRP/Tween.HDRP.TintUnlit.cs @@ -6,6 +6,7 @@ using Unity.Mathematics; using Unity.Rendering; using UnityEngine; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -17,6 +18,7 @@ public static partial class HDRP public static class TintUnlit { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPTintUnlitCommand(entity, start, end, duration, tweenParams); @@ -25,6 +27,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float4 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPTintUnlitCommand(entity, start, end, duration, tweenParams); @@ -33,6 +36,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenHDRPTintUnlitCommand(entity, start, end, duration, tweenParams); @@ -41,6 +45,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -48,6 +53,7 @@ public static uint To(ref SystemState state, in Entity entity, in float4 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -55,6 +61,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -62,6 +69,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -69,6 +77,7 @@ public static uint From(ref SystemState state, in Entity entity, in float4 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -76,6 +85,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -83,72 +93,94 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPTintUnlitCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPTintUnlitCommand(entity, startColour, endColour, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPTintUnlitCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPTintUnlitCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenHDRPTintUnlitCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenHDRPTintUnlitCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); return command.TweenParams.Id; } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/Transform/Tween.Move.cs b/Runtime/Static/Transform/Tween.Move.cs index 630690f..5d79a1c 100644 --- a/Runtime/Static/Transform/Tween.Move.cs +++ b/Runtime/Static/Transform/Tween.Move.cs @@ -1,4 +1,5 @@ -using DotsTween.Tweens; +using System.Runtime.CompilerServices; +using DotsTween.Tweens; using Unity.Burst; using Unity.Entities; using Unity.Mathematics; @@ -12,6 +13,7 @@ public static partial class Tween public static class Move { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenTranslationCommand(entity, start, end, duration, tweenParams); @@ -20,6 +22,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float3 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenTranslationCommand(entity, start, end, duration, tweenParams); @@ -28,6 +31,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenTranslationCommand(entity, start, end, duration, tweenParams); @@ -36,6 +40,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -43,6 +48,7 @@ public static uint To(ref SystemState state, in Entity entity, in float3 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -50,6 +56,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -57,6 +64,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -64,6 +72,7 @@ public static uint From(ref SystemState state, in Entity entity, in float3 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -71,6 +80,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -78,6 +88,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float3 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Position; diff --git a/Runtime/Static/Transform/Tween.NonUniformScale.cs b/Runtime/Static/Transform/Tween.NonUniformScale.cs index 21a31e8..6ea0e66 100644 --- a/Runtime/Static/Transform/Tween.NonUniformScale.cs +++ b/Runtime/Static/Transform/Tween.NonUniformScale.cs @@ -1,4 +1,5 @@ -using DotsTween.Tweens; +using System.Runtime.CompilerServices; +using DotsTween.Tweens; using Unity.Burst; using Unity.Entities; using Unity.Mathematics; @@ -12,6 +13,7 @@ public static partial class Tween public static class NonUniformScale { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenNonUniformScaleCommand(entity, start, end, duration, tweenParams); @@ -20,6 +22,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float3 sta } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenNonUniformScaleCommand(entity, start, end, duration, tweenParams); @@ -28,6 +31,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 start, in float3 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenNonUniformScaleCommand(entity, start, end, duration, tweenParams); @@ -36,6 +40,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -43,6 +48,7 @@ public static uint To(ref SystemState state, in Entity entity, in float3 end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -50,6 +56,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -57,6 +64,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -64,6 +72,7 @@ public static uint From(ref SystemState state, in Entity entity, in float3 start } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -71,6 +80,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float3 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -78,6 +88,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float3 currentValue, ref SystemState state, in Entity entity) { if (!state.EntityManager.HasComponent(entity)) diff --git a/Runtime/Static/Transform/Tween.Rotate.cs b/Runtime/Static/Transform/Tween.Rotate.cs index 8c8dcb1..89880de 100644 --- a/Runtime/Static/Transform/Tween.Rotate.cs +++ b/Runtime/Static/Transform/Tween.Rotate.cs @@ -1,4 +1,5 @@ -using DotsTween.Tweens; +using System.Runtime.CompilerServices; +using DotsTween.Tweens; using Unity.Burst; using Unity.Entities; using Unity.Mathematics; @@ -12,6 +13,7 @@ public static partial class Tween public static class Rotate { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in quaternion start, in quaternion end, in float duration, in TweenParams tweenParams = default) { var command = new TweenRotationCommand(entity, start, end, duration, tweenParams); @@ -20,6 +22,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in quaternion } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in quaternion start, in quaternion end, in float duration, in TweenParams tweenParams = default) { var command = new TweenRotationCommand(entity, start, end, duration, tweenParams); @@ -28,6 +31,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in quat } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in quaternion start, in quaternion end, in float duration, in TweenParams tweenParams = default) { var command = new TweenRotationCommand(entity, start, end, duration, tweenParams); @@ -36,6 +40,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in quaternion end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -43,6 +48,7 @@ public static uint To(ref SystemState state, in Entity entity, in quaternion end } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in quaternion end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -50,6 +56,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in quaternion end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -57,6 +64,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in quaternion start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -64,6 +72,7 @@ public static uint From(ref SystemState state, in Entity entity, in quaternion s } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in quaternion start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -71,6 +80,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in quaternion start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -78,6 +88,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out quaternion currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Rotation; diff --git a/Runtime/Static/Transform/Tween.Scale.cs b/Runtime/Static/Transform/Tween.Scale.cs index fdf7dd7..742c0af 100644 --- a/Runtime/Static/Transform/Tween.Scale.cs +++ b/Runtime/Static/Transform/Tween.Scale.cs @@ -1,4 +1,5 @@ -using DotsTween.Tweens; +using System.Runtime.CompilerServices; +using DotsTween.Tweens; using Unity.Burst; using Unity.Entities; using Unity.Transforms; @@ -11,6 +12,7 @@ public static partial class Tween public static class Scale { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenScaleCommand(entity, start, end, duration, tweenParams); @@ -19,6 +21,7 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenScaleCommand(entity, start, end, duration, tweenParams); @@ -27,6 +30,7 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenScaleCommand(entity, start, end, duration, tweenParams); @@ -35,6 +39,7 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -42,6 +47,7 @@ public static uint To(ref SystemState state, in Entity entity, in float end, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -49,6 +55,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); @@ -56,6 +63,7 @@ public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWri } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -63,6 +71,7 @@ public static uint From(ref SystemState state, in Entity entity, in float start, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -70,6 +79,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in E } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); @@ -77,6 +87,7 @@ public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelW } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Scale; diff --git a/Runtime/Static/Tween.Controls.cs b/Runtime/Static/Tween.Controls.cs index fb487f6..070c4f7 100644 --- a/Runtime/Static/Tween.Controls.cs +++ b/Runtime/Static/Tween.Controls.cs @@ -1,4 +1,5 @@ -using DotsTween.Tweens; +using System.Runtime.CompilerServices; +using DotsTween.Tweens; using Unity.Burst; using Unity.Entities; @@ -12,6 +13,7 @@ public static class Controls #region Control Specific Tween [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Pause(ref EntityManager entityManager, in Entity entity, in uint tweenId) { entityManager.GetBuffer(entity).Add(new TweenPauseInfo(tweenId)); @@ -19,6 +21,7 @@ public static void Pause(ref EntityManager entityManager, in Entity entity, in u } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Pause(ref EntityCommandBuffer commandBuffer, in Entity entity, in uint tweenId) { commandBuffer.AppendToBuffer(entity, new TweenPauseInfo(tweenId)); @@ -26,6 +29,7 @@ public static void Pause(ref EntityCommandBuffer commandBuffer, in Entity entity } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Pause(ref EntityCommandBuffer.ParallelWriter parallelWriter, in int sortKey, in Entity entity, in uint tweenId) { parallelWriter.AppendToBuffer(sortKey, entity, new TweenPauseInfo(tweenId)); @@ -33,6 +37,7 @@ public static void Pause(ref EntityCommandBuffer.ParallelWriter parallelWriter, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Resume(ref EntityManager entityManager, in Entity entity, in uint tweenId) { entityManager.GetBuffer(entity).Add(new TweenResumeInfo(tweenId)); @@ -40,6 +45,7 @@ public static void Resume(ref EntityManager entityManager, in Entity entity, in } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Resume(ref EntityCommandBuffer commandBuffer, in Entity entity, in uint tweenId) { commandBuffer.AppendToBuffer(entity, new TweenResumeInfo(tweenId)); @@ -47,6 +53,7 @@ public static void Resume(ref EntityCommandBuffer commandBuffer, in Entity entit } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Resume(ref EntityCommandBuffer.ParallelWriter parallelWriter, in int sortKey, in Entity entity, in uint tweenId) { parallelWriter.AppendToBuffer(sortKey, entity, new TweenResumeInfo(tweenId)); @@ -54,6 +61,7 @@ public static void Resume(ref EntityCommandBuffer.ParallelWriter parallelWriter, } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Stop(ref EntityManager entityManager, in Entity entity, in uint tweenId) { var destroyBuffer = entityManager.GetBuffer(entity); @@ -61,12 +69,14 @@ public static void Stop(ref EntityManager entityManager, in Entity entity, in ui } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Stop(ref EntityCommandBuffer commandBuffer, in Entity entity, in uint tweenId) { commandBuffer.AppendToBuffer(entity, new TweenDestroyCommand(tweenId)); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Stop(ref EntityCommandBuffer.ParallelWriter parallelWriter, in int sortKey, in Entity entity, in uint tweenId) { parallelWriter.AppendToBuffer(sortKey, entity, new TweenDestroyCommand(tweenId)); @@ -77,6 +87,7 @@ public static void Stop(ref EntityCommandBuffer.ParallelWriter parallelWriter, i #region Control All [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void PauseAll(ref EntityManager entityManager, in Entity entity) { entityManager.GetBuffer(entity).Add(new TweenPauseInfo()); @@ -84,6 +95,7 @@ public static void PauseAll(ref EntityManager entityManager, in Entity entity) } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void PauseAll(ref EntityCommandBuffer commandBuffer, in Entity entity) { commandBuffer.AppendToBuffer(entity, new TweenPauseInfo()); @@ -91,6 +103,7 @@ public static void PauseAll(ref EntityCommandBuffer commandBuffer, in Entity ent } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void PauseAll(ref EntityCommandBuffer.ParallelWriter parallelWriter, in int sortKey, in Entity entity) { parallelWriter.AppendToBuffer(sortKey, entity, new TweenPauseInfo()); @@ -98,6 +111,7 @@ public static void PauseAll(ref EntityCommandBuffer.ParallelWriter parallelWrite } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ResumeAll(ref EntityManager entityManager, in Entity entity) { entityManager.GetBuffer(entity).Add(new TweenResumeInfo()); @@ -105,6 +119,7 @@ public static void ResumeAll(ref EntityManager entityManager, in Entity entity) } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ResumeAll(ref EntityCommandBuffer commandBuffer, in Entity entity) { commandBuffer.AppendToBuffer(entity, new TweenResumeInfo()); @@ -112,6 +127,7 @@ public static void ResumeAll(ref EntityCommandBuffer commandBuffer, in Entity en } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void ResumeAll(ref EntityCommandBuffer.ParallelWriter parallelWriter, in int sortKey, in Entity entity) { parallelWriter.AppendToBuffer(sortKey, entity, new TweenResumeInfo()); @@ -119,6 +135,7 @@ public static void ResumeAll(ref EntityCommandBuffer.ParallelWriter parallelWrit } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void StopAll(ref EntityManager entityManager, in Entity entity) { if (!entityManager.HasBuffer(entity)) return; @@ -130,12 +147,14 @@ public static void StopAll(ref EntityManager entityManager, in Entity entity) } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void StopAll(ref EntityCommandBuffer commandBuffer, in Entity entity) { commandBuffer.AddComponent(entity); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void StopAll(ref EntityCommandBuffer.ParallelWriter parallelWriter, in int sortKey, in Entity entity) { parallelWriter.AddComponent(sortKey, entity); diff --git a/Runtime/Static/Tween.Timeline.cs b/Runtime/Static/Tween.Timeline.cs index 3c223fb..d3a7db0 100644 --- a/Runtime/Static/Tween.Timeline.cs +++ b/Runtime/Static/Tween.Timeline.cs @@ -1,4 +1,5 @@ -using DotsTween.Timelines; +using System.Runtime.CompilerServices; +using DotsTween.Timelines; using Unity.Burst; using Unity.Entities; @@ -10,9 +11,11 @@ public static partial class Tween public static class Timeline { [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Create(out TimelineComponent timelineComponent) => timelineComponent = new TimelineComponent(0f); [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Pause(ref EntityManager entityManager, uint timelinePlaybackId) { var e = entityManager.CreateEntity(); @@ -24,6 +27,7 @@ public static void Pause(ref EntityManager entityManager, uint timelinePlaybackI } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Pause(ref EntityCommandBuffer ecb, uint timelinePlaybackId) { var e = ecb.CreateEntity(); @@ -35,6 +39,7 @@ public static void Pause(ref EntityCommandBuffer ecb, uint timelinePlaybackId) } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Resume(ref EntityManager entityManager, uint timelinePlaybackId) { var e = entityManager.CreateEntity(); @@ -46,6 +51,7 @@ public static void Resume(ref EntityManager entityManager, uint timelinePlayback } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Resume(ref EntityCommandBuffer ecb, uint timelinePlaybackId) { var e = ecb.CreateEntity(); @@ -57,6 +63,7 @@ public static void Resume(ref EntityCommandBuffer ecb, uint timelinePlaybackId) } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Stop(ref EntityManager entityManager, uint timelinePlaybackId) { var e = entityManager.CreateEntity(); @@ -68,6 +75,7 @@ public static void Stop(ref EntityManager entityManager, uint timelinePlaybackId } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Stop(ref EntityCommandBuffer ecb, uint timelinePlaybackId) { var e = ecb.CreateEntity(); diff --git a/Runtime/Static/URP/Tween.URP.BumpScale.cs b/Runtime/Static/URP/Tween.URP.BumpScale.cs index ab8678c..93132eb 100644 --- a/Runtime/Static/URP/Tween.URP.BumpScale.cs +++ b/Runtime/Static/URP/Tween.URP.BumpScale.cs @@ -1,9 +1,9 @@ #if DOTS_TWEEN_URP +using System.Runtime.CompilerServices; using DotsTween.Tweens; using Unity.Burst; using Unity.Entities; using Unity.Rendering; -using Unity.Transforms; namespace DotsTween { @@ -15,7 +15,8 @@ public static partial class URP public static class BumpScale { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPBumpScaleCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -23,7 +24,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPBumpScaleCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -31,7 +33,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPBumpScaleCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -39,48 +42,55 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/URP/Tween.URP.Cutoff.cs b/Runtime/Static/URP/Tween.URP.Cutoff.cs index 310c336..a73e7e5 100644 --- a/Runtime/Static/URP/Tween.URP.Cutoff.cs +++ b/Runtime/Static/URP/Tween.URP.Cutoff.cs @@ -1,9 +1,9 @@ #if DOTS_TWEEN_URP +using System.Runtime.CompilerServices; using DotsTween.Tweens; using Unity.Burst; using Unity.Entities; using Unity.Rendering; -using Unity.Transforms; namespace DotsTween { @@ -15,7 +15,8 @@ public static partial class URP public static class Cutoff { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPCutoffCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -23,7 +24,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPCutoffCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -31,7 +33,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPCutoffCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -39,48 +42,55 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/URP/Tween.URP.EmissionColor.cs b/Runtime/Static/URP/Tween.URP.EmissionColor.cs index 4c8ed92..93f6a1a 100644 --- a/Runtime/Static/URP/Tween.URP.EmissionColor.cs +++ b/Runtime/Static/URP/Tween.URP.EmissionColor.cs @@ -6,6 +6,7 @@ using Unity.Mathematics; using Unity.Rendering; using UnityEngine; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -17,7 +18,8 @@ public static partial class URP public static class EmissionColor { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPEmissionColorCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -25,7 +27,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float4 sta } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPEmissionColorCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -33,7 +36,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPEmissionColorCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -41,114 +45,142 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenURPEmissionColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPEmissionColorCommand(entity, startColour, endColour, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); return command.TweenParams.Id; } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenURPEmissionColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPEmissionColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(entity, command); return command.TweenParams.Id; } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenURPEmissionColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPEmissionColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); return command.TweenParams.Id; } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/URP/Tween.URP.Fade.cs b/Runtime/Static/URP/Tween.URP.Fade.cs index c8c0ab8..c3b49b5 100644 --- a/Runtime/Static/URP/Tween.URP.Fade.cs +++ b/Runtime/Static/URP/Tween.URP.Fade.cs @@ -3,7 +3,7 @@ using Unity.Burst; using Unity.Entities; using Unity.Rendering; -using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,7 +15,8 @@ public static partial class URP public static class Fade { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPFadeCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -23,7 +24,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPFadeCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -31,7 +33,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPFadeCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -39,48 +42,55 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value.w; diff --git a/Runtime/Static/URP/Tween.URP.Metallic.cs b/Runtime/Static/URP/Tween.URP.Metallic.cs index 0e772f5..13594c3 100644 --- a/Runtime/Static/URP/Tween.URP.Metallic.cs +++ b/Runtime/Static/URP/Tween.URP.Metallic.cs @@ -3,7 +3,7 @@ using Unity.Burst; using Unity.Entities; using Unity.Rendering; -using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,7 +15,8 @@ public static partial class URP public static class Metallic { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPMetallicCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -23,7 +24,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPMetallicCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -31,7 +33,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPMetallicCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -39,48 +42,55 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/URP/Tween.URP.OcclusionStrength.cs b/Runtime/Static/URP/Tween.URP.OcclusionStrength.cs index 178acc5..5178624 100644 --- a/Runtime/Static/URP/Tween.URP.OcclusionStrength.cs +++ b/Runtime/Static/URP/Tween.URP.OcclusionStrength.cs @@ -3,7 +3,7 @@ using Unity.Burst; using Unity.Entities; using Unity.Rendering; -using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,7 +15,8 @@ public static partial class URP public static class OcclusionStrength { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPOcclusionStrengthCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -23,7 +24,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPOcclusionStrengthCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -31,7 +33,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPOcclusionStrengthCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -39,48 +42,55 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/URP/Tween.URP.Smoothness.cs b/Runtime/Static/URP/Tween.URP.Smoothness.cs index 0014fc4..4ff4e69 100644 --- a/Runtime/Static/URP/Tween.URP.Smoothness.cs +++ b/Runtime/Static/URP/Tween.URP.Smoothness.cs @@ -3,7 +3,7 @@ using Unity.Burst; using Unity.Entities; using Unity.Rendering; -using Unity.Transforms; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -15,7 +15,8 @@ public static partial class URP public static class Smoothness { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPSmoothnessCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -23,7 +24,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float star } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPSmoothnessCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -31,7 +33,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPSmoothnessCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -39,48 +42,55 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/URP/Tween.URP.SpecularColor.cs b/Runtime/Static/URP/Tween.URP.SpecularColor.cs index 12c619c..489b392 100644 --- a/Runtime/Static/URP/Tween.URP.SpecularColor.cs +++ b/Runtime/Static/URP/Tween.URP.SpecularColor.cs @@ -6,6 +6,7 @@ using Unity.Mathematics; using Unity.Rendering; using UnityEngine; +using System.Runtime.CompilerServices; namespace DotsTween { @@ -17,7 +18,8 @@ public static partial class URP public static class SpecularColor { [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPSpecularColorCommand(entity, start, end, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); @@ -25,7 +27,8 @@ public static uint FromTo(ref SystemState state, in Entity entity, in float4 sta } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPSpecularColorCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(entity, command); @@ -33,7 +36,8 @@ public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in floa } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) { var command = new TweenURPSpecularColorCommand(entity, start, end, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); @@ -41,114 +45,142 @@ public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sor } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var start, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref state, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) { GetCurrentValue(out var end, ref state, entity); return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); } [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenURPSpecularColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPSpecularColorCommand(entity, startColour, endColour, duration, tweenParams); state.EntityManager.AddComponentData(entity, command); return command.TweenParams.Id; } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenURPSpecularColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPSpecularColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(entity, command); return command.TweenParams.Id; } [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) { - var command = new TweenURPSpecularColorCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPSpecularColorCommand(entity, startColour, endColour, duration, tweenParams); ecb.AddComponent(sortKey, entity, command); return command.TweenParams.Id; } [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); } [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) { + end.ToFloat4(out var endColour); GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat4(), duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); } [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) { + start.ToFloat4(out var startColour); GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat4(), end, duration, tweenParams); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); } [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) { currentValue = state.EntityManager.GetComponentData(entity).Value; diff --git a/Runtime/Static/URP/Tween.URP.TInt.cs b/Runtime/Static/URP/Tween.URP.TInt.cs deleted file mode 100644 index ed238f9..0000000 --- a/Runtime/Static/URP/Tween.URP.TInt.cs +++ /dev/null @@ -1,160 +0,0 @@ -#if DOTS_TWEEN_URP -using DotsTween.Math; -using DotsTween.Tweens; -using Unity.Burst; -using Unity.Entities; -using Unity.Mathematics; -using Unity.Rendering; -using UnityEngine; - -namespace DotsTween -{ - public static partial class Tween - { - public static partial class URP - { - [BurstCompile] - public static class Tint - { - [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) - { - var command = new TweenURPTintCommand(entity, start, end, duration, tweenParams); - state.EntityManager.AddComponentData(entity, command); - return command.TweenParams.Id; - } - - [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) - { - var command = new TweenURPTintCommand(entity, start, end, duration, tweenParams); - ecb.AddComponent(entity, command); - return command.TweenParams.Id; - } - - [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) - { - var command = new TweenURPTintCommand(entity, start, end, duration, tweenParams); - ecb.AddComponent(sortKey, entity, command); - return command.TweenParams.Id; - } - - [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end, duration, tweenParams); - } - - [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end, duration, tweenParams); - } - - [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); - } - - [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start, end, duration, tweenParams); - } - - [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start, end, duration, tweenParams); - } - - [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); - } - - [BurstCompile] - public static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) - { - var command = new TweenURPTintCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); - state.EntityManager.AddComponentData(entity, command); - return command.TweenParams.Id; - } - - [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) - { - var command = new TweenURPTintCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); - ecb.AddComponent(entity, command); - return command.TweenParams.Id; - } - - [BurstCompile] - public static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) - { - var command = new TweenURPTintCommand(entity, start.ToFloat4(), end.ToFloat4(), duration, tweenParams); - ecb.AddComponent(sortKey, entity, command); - return command.TweenParams.Id; - } - - [BurstCompile] - public static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var start, ref state, entity); - return FromTo(ref state, entity, start, end.ToFloat4(), duration, tweenParams); - } - - [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, entity, start, end.ToFloat4(), duration, tweenParams); - } - - [BurstCompile] - public static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var start, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start, end.ToFloat4(), duration, tweenParams); - } - - [BurstCompile] - public static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var end, ref state, entity); - return FromTo(ref state, entity, start.ToFloat4(), end, duration, tweenParams); - } - - [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, entity, start.ToFloat4(), end, duration, tweenParams); - } - - [BurstCompile] - public static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) - { - GetCurrentValue(out var end, ref state, entity); - return FromTo(ref ecb, sortKey, entity, start.ToFloat4(), end, duration, tweenParams); - } - - [BurstCompile] - private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) - { - currentValue = state.EntityManager.GetComponentData(entity).Value; - } - } - } - } -} -#endif \ No newline at end of file diff --git a/Runtime/Static/URP/Tween.URP.Tint.cs b/Runtime/Static/URP/Tween.URP.Tint.cs new file mode 100644 index 0000000..f5a5a75 --- /dev/null +++ b/Runtime/Static/URP/Tween.URP.Tint.cs @@ -0,0 +1,192 @@ +#if DOTS_TWEEN_URP +using DotsTween.Math; +using DotsTween.Tweens; +using Unity.Burst; +using Unity.Entities; +using Unity.Mathematics; +using Unity.Rendering; +using UnityEngine; +using System.Runtime.CompilerServices; + +namespace DotsTween +{ + public static partial class Tween + { + public static partial class URP + { + [BurstCompile] + public static class Tint + { + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + { + var command = new TweenURPTintCommand(entity, start, end, duration, tweenParams); + state.EntityManager.AddComponentData(entity, command); + return command.TweenParams.Id; + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + { + var command = new TweenURPTintCommand(entity, start, end, duration, tweenParams); + ecb.AddComponent(entity, command); + return command.TweenParams.Id; + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float4 end, in float duration, in TweenParams tweenParams = default) + { + var command = new TweenURPTintCommand(entity, start, end, duration, tweenParams); + ecb.AddComponent(sortKey, entity, command); + return command.TweenParams.Id; + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + { + GetCurrentValue(out var start, ref state, entity); + return FromTo(ref state, entity, start, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + { + GetCurrentValue(out var start, ref state, entity); + return FromTo(ref ecb, entity, start, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 end, in float duration, in TweenParams tweenParams = default) + { + GetCurrentValue(out var start, ref state, entity); + return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + { + GetCurrentValue(out var end, ref state, entity); + return FromTo(ref state, entity, start, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + { + GetCurrentValue(out var end, ref state, entity); + return FromTo(ref ecb, entity, start, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in float4 start, in float duration, in TweenParams tweenParams = default) + { + GetCurrentValue(out var end, ref state, entity); + return FromTo(ref ecb, sortKey, entity, start, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref SystemState state, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + { + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPTintCommand(entity, startColour, endColour, duration, tweenParams); + state.EntityManager.AddComponentData(entity, command); + return command.TweenParams.Id; + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer ecb, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + { + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPTintCommand(entity, startColour, endColour, duration, tweenParams); + ecb.AddComponent(entity, command); + return command.TweenParams.Id; + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint FromTo(ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in Color end, in float duration, in TweenParams tweenParams = default) + { + start.ToFloat4(out var startColour); + end.ToFloat4(out var endColour); + var command = new TweenURPTintCommand(entity, startColour, endColour, duration, tweenParams); + ecb.AddComponent(sortKey, entity, command); + return command.TweenParams.Id; + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + { + end.ToFloat4(out var endColour); + GetCurrentValue(out var start, ref state, entity); + return FromTo(ref state, entity, start, endColour, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + { + end.ToFloat4(out var endColour); + GetCurrentValue(out var start, ref state, entity); + return FromTo(ref ecb, entity, start, endColour, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint To(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color end, in float duration, in TweenParams tweenParams = default) + { + end.ToFloat4(out var endColour); + GetCurrentValue(out var start, ref state, entity); + return FromTo(ref ecb, sortKey, entity, start, endColour, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + { + start.ToFloat4(out var startColour); + GetCurrentValue(out var end, ref state, entity); + return FromTo(ref state, entity, startColour, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer ecb, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + { + start.ToFloat4(out var startColour); + GetCurrentValue(out var end, ref state, entity); + return FromTo(ref ecb, entity, startColour, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint From(ref SystemState state, ref EntityCommandBuffer.ParallelWriter ecb, in int sortKey, in Entity entity, in Color start, in float duration, in TweenParams tweenParams = default) + { + start.ToFloat4(out var startColour); + GetCurrentValue(out var end, ref state, entity); + return FromTo(ref ecb, sortKey, entity, startColour, end, duration, tweenParams); + } + + [BurstCompile] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static void GetCurrentValue(out float4 currentValue, ref SystemState state, in Entity entity) + { + currentValue = state.EntityManager.GetComponentData(entity).Value; + } + } + } + } +} +#endif \ No newline at end of file diff --git a/Runtime/Timelines/Systems/TimelineControlSystem.cs b/Runtime/Timelines/Systems/TimelineControlSystem.cs index 6b5a7cf..b62bd12 100644 --- a/Runtime/Timelines/Systems/TimelineControlSystem.cs +++ b/Runtime/Timelines/Systems/TimelineControlSystem.cs @@ -29,14 +29,14 @@ protected override void OnUpdate() var ecb = SystemAPI.GetSingleton().CreateCommandBuffer(CheckedStateRef.WorldUnmanaged); // TODO (@dyonng) probably needs optimization to reduce search complexity - foreach (var (control, controlEntity) in SystemAPI.Query().WithEntityAccess()) + foreach (var (controlRef, controlEntity) in SystemAPI.Query>().WithEntityAccess()) { foreach (var timelineEntity in timelineEntities) { var timeline = EntityManager.GetComponentData(timelineEntity); - if (timeline.PlaybackId != control.TimelinePlaybackId) continue; + if (timeline.PlaybackId != controlRef.ValueRO.TimelinePlaybackId) continue; - switch (control.Command) + switch (controlRef.ValueRO.Command) { case TimelineControlCommands.Pause: PauseTimeline(ref ecb, timelineEntity, ref timeline); diff --git a/Runtime/Tweens/Systems/ApplySystems/Transform/TweenSplineMovementSystem.cs b/Runtime/Tweens/Systems/ApplySystems/Transform/TweenSplineMovementSystem.cs index 36e9e88..ac28feb 100644 --- a/Runtime/Tweens/Systems/ApplySystems/Transform/TweenSplineMovementSystem.cs +++ b/Runtime/Tweens/Systems/ApplySystems/Transform/TweenSplineMovementSystem.cs @@ -19,46 +19,46 @@ protected override void OnCreate() protected override void OnUpdate() { - foreach (var (localTransformRef, tweenInfo, tweenBuffer) in SystemAPI.Query, TweenSplineMovement, DynamicBuffer>()) + foreach (var (localTransformRef, tweenInfoRef, tweenBuffer) in SystemAPI.Query, RefRW, DynamicBuffer>()) { foreach (var tween in tweenBuffer) { - if (tween.Id != tweenInfo.Id || tween.IsPaused) continue; + if (tween.Id != tweenInfoRef.ValueRO.Id || tween.IsPaused) continue; - float splinePosition = math.lerp(tweenInfo.SplineTweenInfo.NormalizedStartPosition, tweenInfo.SplineTweenInfo.NormalizedEndPosition, tween.EasePercentage); - localTransformRef.ValueRW.Position = tweenInfo.SplineTweenInfo.Spline.EvaluatePosition(splinePosition); + float splinePosition = math.lerp(tweenInfoRef.ValueRO.SplineTweenInfo.NormalizedStartPosition, tweenInfoRef.ValueRO.SplineTweenInfo.NormalizedEndPosition, tween.EasePercentage); + localTransformRef.ValueRW.Position = tweenInfoRef.ValueRO.SplineTweenInfo.Spline.EvaluatePosition(splinePosition); - switch (tweenInfo.SplineTweenInfo.Alignment.Mode) + switch (tweenInfoRef.ValueRO.SplineTweenInfo.Alignment.Mode) { case TweenSplineAlignMode.Full: { - var forward = math.normalize(tweenInfo.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); - var up = tweenInfo.SplineTweenInfo.Spline.EvaluateUpVector(splinePosition); + var forward = math.normalize(tweenInfoRef.ValueRO.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); + var up = tweenInfoRef.ValueRO.SplineTweenInfo.Spline.EvaluateUpVector(splinePosition); localTransformRef.ValueRW.Rotation = math.normalize(quaternion.LookRotationSafe(forward, up)); break; } case TweenSplineAlignMode.XAxis: { - float3 tangent = math.normalize(tweenInfo.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); + float3 tangent = math.normalize(tweenInfoRef.ValueRO.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); float angleRadians = math.atan2(tangent.y, tangent.z); - if (!float.IsNaN(angleRadians)) localTransformRef.ValueRW.Rotation = quaternion.Euler(new float3(angleRadians - tweenInfo.SplineTweenInfo.Alignment.AngleOffsetRadians, 0f, 0f)); + if (!float.IsNaN(angleRadians)) localTransformRef.ValueRW.Rotation = quaternion.Euler(new float3(angleRadians - tweenInfoRef.ValueRO.SplineTweenInfo.Alignment.AngleOffsetRadians, 0f, 0f)); break; } case TweenSplineAlignMode.YAxis: { - float3 tangent = math.normalize(tweenInfo.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); + float3 tangent = math.normalize(tweenInfoRef.ValueRO.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); float angleRadians = math.atan2(tangent.z, tangent.x); - if (!float.IsNaN(angleRadians)) localTransformRef.ValueRW.Rotation = quaternion.Euler(new float3(0f, angleRadians - tweenInfo.SplineTweenInfo.Alignment.AngleOffsetRadians, 0f)); + if (!float.IsNaN(angleRadians)) localTransformRef.ValueRW.Rotation = quaternion.Euler(new float3(0f, angleRadians - tweenInfoRef.ValueRO.SplineTweenInfo.Alignment.AngleOffsetRadians, 0f)); break; } case TweenSplineAlignMode.ZAxis: { - float3 tangent = math.normalize(tweenInfo.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); + float3 tangent = math.normalize(tweenInfoRef.ValueRO.SplineTweenInfo.Spline.EvaluateTangent(splinePosition)); float angleRadians = math.atan2(tangent.y, tangent.x); - if (!float.IsNaN(angleRadians)) localTransformRef.ValueRW.Rotation = quaternion.Euler(new float3(0f, 0f, angleRadians - tweenInfo.SplineTweenInfo.Alignment.AngleOffsetRadians)); + if (!float.IsNaN(angleRadians)) localTransformRef.ValueRW.Rotation = quaternion.Euler(new float3(0f, 0f, angleRadians - tweenInfoRef.ValueRO.SplineTweenInfo.Alignment.AngleOffsetRadians)); break; } diff --git a/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/encodings.xml b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/indexLayout.xml b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/projectSettingsUpdater.xml b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..4bb9f4d --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/vcs.xml b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/vcs.xml new file mode 100644 index 0000000..bc59970 --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/workspace.xml b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/workspace.xml new file mode 100644 index 0000000..4e83475 --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/.idea/.idea.Jobless.dir/.idea/workspace.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1695039979364 + + + + + + + + \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenDestroySystem.cs.meta b/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenDestroySystem.cs.meta deleted file mode 100644 index f7b8bdf..0000000 --- a/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenDestroySystem.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7a16778d23d74988ace18d89c5a43099 -timeCreated: 1677905498 \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenGenerateSystem.cs b/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenGenerateSystem.cs index 53f3e62..f50c060 100644 --- a/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenGenerateSystem.cs +++ b/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenGenerateSystem.cs @@ -1,65 +1,17 @@ -using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using Unity.Burst; using Unity.Entities; -using Unity.Transforms; namespace DotsTween.Tweens { - [UpdateInGroup(typeof(TweenGenerateSystemGroup))] [BurstCompile] - internal abstract partial class JoblessTweenGenerateSystem : SystemBase - where TTweenCommand : unmanaged, IComponentData, ITweenParams, ITweenInfo - where TTweenInfo : unmanaged, IComponentData, ITweenId, ITweenInfo - where TTarget : unmanaged, IComponentData - where TTweenInfoValue : unmanaged + [UpdateInGroup(typeof(TweenGenerateSystemGroup))] + internal abstract partial class JoblessTweenGenerateSystem : SystemBase { [BurstCompile] - protected override void OnCreate() - { - RequireForUpdate(); - } - - [BurstCompile] - protected override void OnUpdate() - { - var ecb = SystemAPI.GetSingleton().CreateCommandBuffer(World.Unmanaged); - - foreach (var (commandRef, entity) in SystemAPI.Query>().WithEntityAccess()) - { - var chunk = EntityManager.GetChunk(entity); - - bool hasTweenStateBuffer = chunk.Has(); - bool hasTweenPauseBuffer = chunk.Has(); - bool hasTweenResumeBuffer = chunk.Has(); - - TryToAddBuffers(out var buffersWereAdded, ref ecb, entity, hasTweenStateBuffer, hasTweenPauseBuffer, hasTweenResumeBuffer); - - if (buffersWereAdded) - { - break; - } - - if (!chunk.Has()) - { - ecb.AddComponent(entity); - } - - var tweenParams = commandRef.ValueRO.GetTweenParams(); - TweenState tween = new TweenState(tweenParams); - ecb.AppendToBuffer(entity, tween); - tweenParams.OnStart.Perform(ref ecb, entity); - - TTweenInfo info = default; - info.SetTweenId(tween.Id); - info.SetTweenInfo(commandRef.ValueRO.GetTweenStart(), commandRef.ValueRO.GetTweenEnd()); - - ecb.AddComponent(entity, info); - ecb.RemoveComponent(entity); - } - } - - [BurstCompile] - private void TryToAddBuffers( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + protected void TryToAddBuffers( out bool buffersWereAdded, ref EntityCommandBuffer ecb, in Entity entity, @@ -76,7 +28,4 @@ private void TryToAddBuffers( || !hasTweenResumeBuffer; } } -#if DOTS_TWEEN_SPLINES - [BurstCompile] internal partial class TweenSplineMovementGenerateSystem : JoblessTweenGenerateSystem { } -#endif } \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/Spline.meta b/Runtime/Tweens/Systems/Control/Jobless/Spline.meta new file mode 100644 index 0000000..652faf8 --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/Spline.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: afadceed6a6c463d828336aa6925d80c +timeCreated: 1695041271 \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenDestroySystem.cs b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementDestroySystem.cs similarity index 70% rename from Runtime/Tweens/Systems/Control/Jobless/JoblessTweenDestroySystem.cs rename to Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementDestroySystem.cs index 0c03b44..644e31a 100644 --- a/Runtime/Tweens/Systems/Control/Jobless/JoblessTweenDestroySystem.cs +++ b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementDestroySystem.cs @@ -1,18 +1,18 @@ -using Unity.Burst; +#if DOTS_TWEEN_SPLINES +using Unity.Burst; using Unity.Entities; -namespace DotsTween.Tweens +namespace DotsTween.Tweens.Spline { [BurstCompile] [UpdateInGroup(typeof(TweenDestroySystemGroup))] - internal partial class JoblessTweenDestroySystem : SystemBase - where TTweenInfo : unmanaged, IComponentData, ITweenId, ITweenInfo + internal partial class TweenSplineMovementDestroySystem : SystemBase { [BurstCompile] protected override void OnCreate() { RequireForUpdate(); - RequireForUpdate(); + RequireForUpdate(); RequireForUpdate(); } @@ -20,9 +20,8 @@ protected override void OnCreate() protected override void OnUpdate() { var ecb = SystemAPI.GetSingleton().CreateCommandBuffer(World.Unmanaged); - var tweenInfoTypeIndex = TypeManager.GetTypeIndex(typeof(TTweenInfo)); - foreach (var (infoRef, destroyBuffer, tweenBuffer, entity) in SystemAPI.Query, DynamicBuffer, DynamicBuffer>().WithEntityAccess()) + foreach (var (infoRef, destroyBuffer, tweenBuffer, entity) in SystemAPI.Query, DynamicBuffer, DynamicBuffer>().WithEntityAccess()) { if (destroyBuffer.IsEmpty) continue; @@ -51,15 +50,12 @@ protected override void OnUpdate() tweenBuffer[j].Settings.OnComplete.Perform(ref ecb, entity); tweenBuffer.RemoveAt(j); infoRef.ValueRW.Cleanup(); - ecb.RemoveComponent(entity); + ecb.RemoveComponent(entity); break; } } } } } - -#if DOTS_TWEEN_SPLINES - [BurstCompile] internal partial class TweenSplineMovementDestroySystem : JoblessTweenDestroySystem { } -#endif -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementDestroySystem.cs.meta b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementDestroySystem.cs.meta new file mode 100644 index 0000000..dd44a71 --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementDestroySystem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 32b054898a354b9dbbbf382f576f677c +timeCreated: 1695041832 \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementGenerateSystem.cs b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementGenerateSystem.cs new file mode 100644 index 0000000..ae2e154 --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementGenerateSystem.cs @@ -0,0 +1,57 @@ +#if DOTS_TWEEN_SPLINES +using Unity.Burst; +using Unity.Entities; +using Unity.Transforms; + +namespace DotsTween.Tweens.Spline +{ + [BurstCompile] + internal partial class TweenSplineMovementGenerateSystem : JoblessTweenGenerateSystem + { + [BurstCompile] + protected override void OnCreate() + { + RequireForUpdate(); + } + + [BurstCompile] + protected override void OnUpdate() + { + var ecb = SystemAPI.GetSingleton().CreateCommandBuffer(World.Unmanaged); + + foreach (var (commandRef, entity) in SystemAPI.Query>().WithEntityAccess()) + { + var chunk = EntityManager.GetChunk(entity); + + bool hasTweenStateBuffer = chunk.Has(); + bool hasTweenPauseBuffer = chunk.Has(); + bool hasTweenResumeBuffer = chunk.Has(); + + TryToAddBuffers(out var buffersWereAdded, ref ecb, entity, hasTweenStateBuffer, hasTweenPauseBuffer, hasTweenResumeBuffer); + + if (buffersWereAdded) + { + break; + } + + if (!chunk.Has()) + { + ecb.AddComponent(entity); + } + + var tweenParams = commandRef.ValueRO.GetTweenParams(); + TweenState tween = new TweenState(tweenParams); + ecb.AppendToBuffer(entity, tween); + tweenParams.OnStart.Perform(ref ecb, entity); + + TweenSplineMovement info = default; + info.SetTweenId(tween.Id); + info.SetTweenInfo(commandRef.ValueRO.GetTweenStart(), commandRef.ValueRO.GetTweenEnd()); + + ecb.AddComponent(entity, info); + ecb.RemoveComponent(entity); + } + } + } +} +#endif \ No newline at end of file diff --git a/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementGenerateSystem.cs.meta b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementGenerateSystem.cs.meta new file mode 100644 index 0000000..02e403e --- /dev/null +++ b/Runtime/Tweens/Systems/Control/Jobless/Spline/TweenSplineMovementGenerateSystem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 602f659ffce544d0b31a83fcf5026b96 +timeCreated: 1695041300 \ No newline at end of file diff --git a/Runtime/Tweens/TweenParams.cs b/Runtime/Tweens/TweenParams.cs index 8bca841..b08769a 100644 --- a/Runtime/Tweens/TweenParams.cs +++ b/Runtime/Tweens/TweenParams.cs @@ -4,6 +4,7 @@ namespace DotsTween.Tweens { + [BurstCompile] public struct TweenParams { public float Duration { get; internal set; } diff --git a/package.json b/package.json index 3ca1a6a..5954f37 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "name": "com.dyonng.dotstween", - "version": "0.9.1", + "version": "0.10.0", "displayName": "DOTS Tween", "description": "Tween library for Unity ECS/DOTS.", "unity": "2022.3", "dependencies": { "com.unity.collections": "2.1.4", - "com.unity.entities": "1.0.11", - "com.unity.burst": "1.8.7", + "com.unity.entities": "1.0.16", + "com.unity.burst": "1.8.8", "com.unity.mathematics": "1.2.6", - "com.unity.entities.graphics": "1.0.11" + "com.unity.entities.graphics": "1.0.16" }, "author": { "name": "Dyon",