diff --git a/Packages/tlp.udonutils/README.md b/Packages/tlp.udonutils/README.md index 67a1f3d..43a7512 100644 --- a/Packages/tlp.udonutils/README.md +++ b/Packages/tlp.udonutils/README.md @@ -30,6 +30,21 @@ The used pattern MAJOR.MINOR.PATCH indicates: All notable changes to this project will be documented in this file. +### [5.0.0] - 2024-04-07 + +#### 🚀 Features + +- *(TlpAccurateSyncBehaviour)* Extract Update methods into new child classes: TlpAccurateSyncBehaviourUpdate/TlpAccurateSyncBehaviourFixedUpdate +- *(TlpAccurateSyncBehaviour)* [**breaking**] Remove getter for synced send time, make network state private + +#### 🧪 Testing + +- *(TlpAccurateSyncBehaviour)* Verify update methods provide correct snapshot ages + +#### ⚙️ Miscellaneous Tasks + +- Bump version + ### [4.0.1] - 2024-04-07 #### 🐛 Bug Fixes diff --git a/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset b/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset index e9fb0f9..49b8db1 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset +++ b/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 22 + Data: 16 - Name: Entry: 7 Data: @@ -786,342 +786,12 @@ MonoBehaviour: - Name: Entry: 7 Data: - - Name: $k - Entry: 1 - Data: DebugVelocity - - Name: $v - Entry: 7 - Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugVelocity - - Name: k__BackingField - Entry: 7 - Data: 48|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Single, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 49|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 50|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs - - Name: $v - Entry: 7 - Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 52|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 53|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: $v - Entry: 7 - Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 55|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 56|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: $v - Entry: 7 - Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 59|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAgeVelocity - - Name: $v - Entry: 7 - Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeVelocity - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 62|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAgeAcceleration - - Name: $v - Entry: 7 - Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeAcceleration - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 64|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 65|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - Name: $k Entry: 1 Data: _position - Name: $v Entry: 7 - Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _position @@ -1145,7 +815,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 48|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1169,7 +839,7 @@ MonoBehaviour: Data: ToTrack - Name: $v Entry: 7 - Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: ToTrack @@ -1193,13 +863,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 69|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 70|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 51|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -1223,13 +893,13 @@ MonoBehaviour: Data: TimeSource - Name: $v Entry: 7 - Data: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: TimeSource - Name: k__BackingField Entry: 7 - Data: 72|System.RuntimeType, mscorlib + Data: 53|System.RuntimeType, mscorlib - Name: Entry: 1 Data: TLP.UdonUtils.Sources.TimeSource, TLP.UdonUtils.Runtime @@ -1253,13 +923,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 73|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 54|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 74|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 55|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset b/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset index 381e71a..8edc03f 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset +++ b/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 22 + Data: 16 - Name: Entry: 7 Data: @@ -786,342 +786,12 @@ MonoBehaviour: - Name: Entry: 7 Data: - - Name: $k - Entry: 1 - Data: DebugVelocity - - Name: $v - Entry: 7 - Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugVelocity - - Name: k__BackingField - Entry: 7 - Data: 48|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Single, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 49|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 50|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs - - Name: $v - Entry: 7 - Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 52|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 53|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: $v - Entry: 7 - Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 55|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 56|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: $v - Entry: 7 - Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 59|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAgeVelocity - - Name: $v - Entry: 7 - Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeVelocity - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 62|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAgeAcceleration - - Name: $v - Entry: 7 - Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeAcceleration - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 64|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 65|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - Name: $k Entry: 1 Data: ToTrack - Name: $v Entry: 7 - Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: ToTrack @@ -1145,13 +815,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 48|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 68|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 49|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -1175,7 +845,7 @@ MonoBehaviour: Data: _position - Name: $v Entry: 7 - Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _position @@ -1199,7 +869,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 70|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1223,7 +893,7 @@ MonoBehaviour: Data: _positionTime - Name: $v Entry: 7 - Data: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _positionTime @@ -1247,7 +917,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset b/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset index 20c3446..cbc6f36 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset +++ b/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 23 + Data: 17 - Name: Entry: 7 Data: @@ -788,19 +788,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: DebugVelocity + Data: ToTrack - Name: $v Entry: 7 Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: DebugVelocity + Data: ToTrack - Name: k__BackingField Entry: 7 Data: 48|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: System.Single, mscorlib + Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule - Name: Entry: 8 Data: @@ -846,348 +846,18 @@ MonoBehaviour: - Name: Entry: 7 Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs - - Name: $v - Entry: 7 - Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 52|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 53|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: $v - Entry: 7 - Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 55|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 56|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: $v - Entry: 7 - Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 59|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAgeVelocity - - Name: $v - Entry: 7 - Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeVelocity - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 62|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: DebugAgeAcceleration - - Name: $v - Entry: 7 - Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeAcceleration - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 9 - Data: 48 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 64|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 65|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: ToTrack - - Name: $v - Entry: 7 - Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: ToTrack - - Name: k__BackingField - Entry: 7 - Data: 67|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 67 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 68|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 69|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: - Name: $k Entry: 1 Data: TimeSource - Name: $v Entry: 7 - Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: TimeSource - Name: k__BackingField Entry: 7 - Data: 71|System.RuntimeType, mscorlib + Data: 52|System.RuntimeType, mscorlib - Name: Entry: 1 Data: TLP.UdonUtils.Sources.TimeSource, TLP.UdonUtils.Runtime @@ -1211,13 +881,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 73|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 54|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -1241,13 +911,13 @@ MonoBehaviour: Data: _position - Name: $v Entry: 7 - Data: 74|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _position - Name: k__BackingField Entry: 7 - Data: 75|System.RuntimeType, mscorlib + Data: 56|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Vector3, UnityEngine.CoreModule @@ -1256,7 +926,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 75 + Data: 56 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1271,7 +941,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 76|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1295,13 +965,13 @@ MonoBehaviour: Data: _rotation - Name: $v Entry: 7 - Data: 77|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _rotation - Name: k__BackingField Entry: 7 - Data: 78|System.RuntimeType, mscorlib + Data: 59|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Quaternion, UnityEngine.CoreModule @@ -1310,7 +980,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 78 + Data: 59 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1325,7 +995,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 79|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.asset b/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.asset index 12b828f..8f4bdf9 100644 --- a/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.asset +++ b/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.asset @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 21 + Data: 20 - Name: Entry: 7 Data: @@ -1237,60 +1237,6 @@ MonoBehaviour: - Name: Entry: 8 Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: RunTestOnPlayerJoin - - Name: $v - Entry: 7 - Data: 76|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: RunTestOnPlayerJoin - - Name: k__BackingField - Entry: 9 - Data: 25 - - Name: k__BackingField - Entry: 9 - Data: 25 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 6 - Data: - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 77|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 78|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - Name: Entry: 13 Data: diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs index f98d6a1..b495ec6 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs @@ -9,6 +9,9 @@ namespace TLP.UdonUtils.Sync { + /// + /// Base Sync Behaviour for movement prediction based on received values from the current owner + /// [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] public abstract class TlpAccurateSyncBehaviour : TlpBaseBehaviour @@ -27,38 +30,30 @@ public abstract class TlpAccurateSyncBehaviour : TlpBaseBehaviour #endregion #region NetworkState - public double SendTime - { - get - { - DebugLog($"Get {nameof(SendTime)} = {SyncedSendTime}s"); - return SyncedSendTime; - } - set - { - DebugLog($"Set {nameof(SendTime)} = {SyncedSendTime}s to {value}s"); - SyncedSendTime = value; - DebugLog($"{nameof(SendTime)} = {SyncedSendTime}s"); - } - } - [UdonSynced] - public double SyncedSendTime = double.MinValue; + [SerializeField] + private double SyncedSendTime = double.MinValue; #region Working Copy - protected internal double WorkingSendTime; + protected internal double WorkingSendTime = double.MinValue; #endregion #endregion #region Settings - public bool UseFixedUpdate; - [Tooltip("0 [s] by default (full prediction), number of seconds that shall be removed from prediction")] [Range(0, 1)] public float PredictionReduction; #endregion #region Network Events + /// + /// Copy the working state to the network state + /// + public override void OnPreSerialization() { + base.OnPreSerialization(); + CreateNetworkStateFromWorkingState(); + } + public override void OnDeserialization(DeserializationResult deserializationResult) { base.OnDeserialization(deserializationResult); DebugLog($"Latency VRC = {deserializationResult.Latency()} vs own {GetAge()}"); @@ -78,44 +73,6 @@ public override void OnDeserialization(DeserializationResult deserializationResu } #endregion - #region U# Lifecycle - public virtual void Update() { - if (UseFixedUpdate) { - return; - } - - #region TLP_DEBUG -#if TLP_DEBUG - DebugLog(nameof(Update)); -#endif - #endregion - - if (Networking.IsOwner(gameObject)) { - return; - } - - PredictMovement(GetElapsed(), Time.deltaTime); - } - - public virtual void FixedUpdate() { - if (!UseFixedUpdate) { - return; - } - - #region TLP_DEBUG -#if TLP_DEBUG - DebugLog(nameof(FixedUpdate)); -#endif - #endregion - - if (Networking.IsOwner(gameObject)) { - return; - } - - PredictMovement(GetElapsed(), Time.fixedDeltaTime); - } - #endregion - #region Hook Implementations protected override bool SetupAndValidate() { if (!base.SetupAndValidate()) return false; @@ -124,12 +81,12 @@ protected override bool SetupAndValidate() { return false; } - if (!Utilities.IsValid(Snapshot)) { - Error($"{nameof(Snapshot)} not set"); - return false; + if (Utilities.IsValid(Snapshot)) { + return true; } - return true; + Error($"{nameof(Snapshot)} not set"); + return false; } #endregion @@ -144,19 +101,38 @@ protected virtual void RecordSnapshot(TimeSnapshot timeSnapshot, float mostRecen /// /// number of seconds that have passed relative to /// time since the recording of the latest - /// depending on it is - /// either or + /// time since previous update protected abstract void PredictMovement(float receivedSnapshotAge, float deltaTime); protected virtual void CreateWorkingCopyOfNetworkState() { + #region TLP_DEBUG +#if TLP_DEBUG DebugLog(nameof(CreateWorkingCopyOfNetworkState)); +#endif + #endregion + WorkingSendTime = SyncedSendTime; } + + protected virtual void CreateNetworkStateFromWorkingState() { + #region TLP_DEBUG +#if TLP_DEBUG + DebugLog(nameof(CreateNetworkStateFromWorkingState)); +#endif + #endregion + + SyncedSendTime = WorkingSendTime; + } #endregion #region Internal internal float GetElapsed() { + #region TLP_DEBUG +#if TLP_DEBUG DebugLog(nameof(GetElapsed)); +#endif + #endregion + return (float)(GetAge() - PredictionReduction); } @@ -171,7 +147,13 @@ private bool ReceivedNetworkStateIsOutdated() { } internal double GetAge() { + #region TLP_DEBUG +#if TLP_DEBUG DebugLog($"{nameof(GetAge)}: {NetworkTime.TimeAsDouble()} - {WorkingSendTime}"); + +#endif + #endregion + return NetworkTime.TimeAsDouble() - WorkingSendTime; } #endregion diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs new file mode 100644 index 0000000..dd017f6 --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using VRC.SDKBase; + +namespace TLP.UdonUtils.Sync +{ + /// + /// Variant that predicts movement based on + /// + public abstract class TlpAccurateSyncBehaviourFixedUpdate : TlpAccurateSyncBehaviour + { + #region U# Lifecycle + public void FixedUpdate() { + #region TLP_DEBUG +#if TLP_DEBUG + DebugLog(nameof(FixedUpdate)); +#endif + #endregion + + if (Networking.IsOwner(gameObject)) { + return; + } + + PredictMovement(GetElapsed(), Time.fixedDeltaTime); + } + #endregion + } +} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs.meta b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs.meta new file mode 100644 index 0000000..f81877a --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ad2d38f6a3074a2b9bd0b8b6775e7b8f +timeCreated: 1712503526 \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs new file mode 100644 index 0000000..33a3c0a --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using VRC.SDKBase; + +namespace TLP.UdonUtils.Sync +{ + /// + /// Variant that predicts movement based on + /// + public abstract class TlpAccurateSyncBehaviourUpdate : TlpAccurateSyncBehaviour + { + #region U# Lifecycle + public void Update() { + #region TLP_DEBUG +#if TLP_DEBUG + DebugLog(nameof(Update)); +#endif + #endregion + + if (Networking.IsOwner(gameObject)) { + return; + } + + PredictMovement(GetElapsed(), Time.deltaTime); + } + #endregion + } +} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs.meta b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs.meta new file mode 100644 index 0000000..36e7e1c --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 03c4888e6b0e487793048d63713b8433 +timeCreated: 1712503411 \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs b/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs index 48229a1..36b9470 100644 --- a/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs +++ b/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs @@ -115,22 +115,26 @@ public void ExecuteScheduledSerialization() { } public override void OnPreSerialization() { + #region TLP_DEBUG +#if TLP_DEBUG DebugLog(nameof(OnPreSerialization)); +#endif + #endregion + if (PendingSerializations < 1) { PendingSerializations = 1; } } public override void OnPostSerialization(SerializationResult result) { + #region TLP_DEBUG #if TLP_DEBUG - DebugLog(nameof(OnPostSerialization)); + DebugLog( + $"{nameof(OnPostSerialization)}: {(result.success ? $"Sent {result.byteCount} bytes after {PendingSerializations} send requests" : $"Sending failed, {PendingSerializations} send requests active")}"); #endif + #endregion + if (result.success) { -#if TLP_DEBUG - DebugLog( - $"{nameof(OnPostSerialization)} wrote {result.byteCount} bytes of {PendingSerializations} serialization requests to the network" - ); -#endif PendingSerializations = 0; return; } @@ -154,13 +158,13 @@ public virtual void Start() { #endregion if (!SetupAndValidate()) { - ErrorAndDisableGameObject($"Some dependencies are not set up correctly. Deactivating {gameObject.transform.GetPathInScene()}"); + ErrorAndDisableGameObject( + $"Some dependencies are not set up correctly. Deactivating {gameObject.transform.GetPathInScene()}"); } } #endregion #region Hooks - /// /// Hook that is called during that shall be used to verify /// that e.g. all serialized references are setup correctly. diff --git a/Packages/tlp.udonutils/package.json b/Packages/tlp.udonutils/package.json index 3ce2584..0498dbe 100644 --- a/Packages/tlp.udonutils/package.json +++ b/Packages/tlp.udonutils/package.json @@ -1,7 +1,7 @@ { "name": "tlp.udonutils", "displayName": "TLP UdonUtils", - "version": "4.0.1", + "version": "5.0.0", "description": "Contains the base scripts/tools for TLP packages as well as prefabs and potentially helpful scripts for VRChat worlds.", "gitDependencies": {}, "legacyFolders": { diff --git a/README.md b/README.md index 67a1f3d..43a7512 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,21 @@ The used pattern MAJOR.MINOR.PATCH indicates: All notable changes to this project will be documented in this file. +### [5.0.0] - 2024-04-07 + +#### 🚀 Features + +- *(TlpAccurateSyncBehaviour)* Extract Update methods into new child classes: TlpAccurateSyncBehaviourUpdate/TlpAccurateSyncBehaviourFixedUpdate +- *(TlpAccurateSyncBehaviour)* [**breaking**] Remove getter for synced send time, make network state private + +#### 🧪 Testing + +- *(TlpAccurateSyncBehaviour)* Verify update methods provide correct snapshot ages + +#### ⚙️ Miscellaneous Tasks + +- Bump version + ### [4.0.1] - 2024-04-07 #### 🐛 Bug Fixes