diff --git a/Packages/tlp.udonutils/README.md b/Packages/tlp.udonutils/README.md index 6d690b5..1289005 100644 --- a/Packages/tlp.udonutils/README.md +++ b/Packages/tlp.udonutils/README.md @@ -36,6 +36,17 @@ The used pattern MAJOR.MINOR.PATCH indicates: All notable changes to this project will be documented in this file. +### [10.0.0] - 2024-11-02 + +#### 🚀 Features + +- *(StateMachine)* Add transtion to delayed method to statemachine +- [**breaking**] Deterministic execution order of scripts to address know VRC-bug + +#### 🐛 Bug Fixes + +- *(RigidbodyVelocityProvider)* Add missing dependency validation + ### [9.0.0] - 2024-08-20 #### 🚀 Features diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.asset b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.asset index e9b3bf8..5fa0a1e 100644 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.asset +++ b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: bfdd9ee40435204498a122768d780b74, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 3490165456808884842 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.cs b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.cs index d1dffdc..f127db0 100644 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.cs +++ b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolAdapter.cs @@ -10,17 +10,17 @@ namespace TLP.UdonUtils.Runtime.Adapters.Cyan { /// /// Adapter that allows retrieving objects from the CyanPlayerObjectPool - /// with having to reference it directly. + /// without having to reference it directly. /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(CyanPoolAdapter), ExecutionOrder)] public class CyanPoolAdapter : TlpBaseBehaviour { - [PublicAPI] protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultEnd; + public new const int ExecutionOrder = CyanPoolEventListener.ExecutionOrder + 1; [FormerlySerializedAs("cyanPlayerObjectAssigner")] public CyanPlayerObjectAssigner CyanPlayerObjectAssigner; diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.asset b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.asset deleted file mode 100644 index 5fc4d6f..0000000 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.asset +++ /dev/null @@ -1,992 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} - m_Name: CyanPoolEventListener - m_EditorClassIdentifier: - serializedUdonProgramAsset: {fileID: 11400000, guid: e2e30a2cffe59bf478fe7ac646e96695, - type: 2} - udonAssembly: - assemblyError: - sourceCsScript: {fileID: 11500000, guid: d7b87b9200c2e0542badfafbc369daa9, type: 3} - scriptVersion: 2 - compiledVersion: 2 - behaviourSyncMode: 0 - hasInteractEvent: 0 - scriptID: -3380246762151393710 - serializationData: - SerializedFormat: 2 - SerializedBytes: - ReferencedUnityObjects: [] - SerializedBytesString: - Prefab: {fileID: 0} - PrefabModificationsReferencedUnityObjects: [] - PrefabModifications: [] - SerializationNodes: - - Name: fieldDefinitions - Entry: 7 - Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, - UdonSharp.Editor]], mscorlib - - Name: comparer - Entry: 7 - Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, - mscorlib]], mscorlib - - Name: - Entry: 8 - Data: - - Name: - Entry: 12 - Data: 15 - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: $v - Entry: 7 - Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: k__BackingField - Entry: 7 - Data: 3|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Boolean, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Networking - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: If true and a serialization request fails it will automatically try to - send again in the next frame until it succeeds. Only applies to owned objects - and manual sync. - - 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: PauseSynchronization - - Name: $v - Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PauseSynchronization - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Has no effect unless implemented by this particular script. See SyncPaused - property for details. - - 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: Severity - - Name: $v - Entry: 7 - Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Severity - - Name: k__BackingField - Entry: 7 - Data: 12|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 13|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Int32, mscorlib - - Name: - Entry: 8 - Data: - - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Logging - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: 'What kind of logs of this behavior shall be produced. Selected severity - includes all more severe levels. Example: selecting ''Warning'' also allows - ''Error'' and ''Assertion'' messages to appear. - - Note: - - ''Debug'' - messages are filtered out by default, even when selected. Add the compiler - definition ''TLP_DEBUG'' in the Unity player settings to enable them. This - should only ever be used for debugging (performance suffers)!' - - 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: PendingSerializations - - Name: $v - Entry: 7 - Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PendingSerializations - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 9 - Data: 13 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: _hadLogger - - Name: $v - Entry: 7 - Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: _hadLogger - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: k__BackingField - - Name: $v - Entry: 7 - Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: k__BackingField - - Name: k__BackingField - Entry: 7 - Data: 23|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 24|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: VRC.Udon.UdonBehaviour, VRC.Udon - - Name: - Entry: 8 - Data: - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: EventInstigator - - Name: $v - Entry: 7 - Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: EventInstigator - - Name: k__BackingField - Entry: 7 - Data: 27|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool - - Name: $v - Entry: 7 - Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Pool - - Name: k__BackingField - Entry: 9 - Data: 27 - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse - - Name: $v - Entry: 7 - Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PoolableInUse - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 40|UnityEngine.HideInInspector, 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: playerAssignedPlayer - - Name: $v - Entry: 7 - Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: playerAssignedPlayer - - Name: k__BackingField - Entry: 7 - Data: 42|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 42 - - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 44|JetBrains.Annotations.PublicAPIAttribute, 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: playerAssignedIndex - - Name: $v - Entry: 7 - Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: playerAssignedIndex - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 9 - Data: 13 - - 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: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 47|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 48|UnityEngine.HideInInspector, 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: playerAssignedPoolObject - - Name: $v - Entry: 7 - Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: playerAssignedPoolObject - - Name: k__BackingField - Entry: 9 - Data: 24 - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 51|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 52|UnityEngine.HideInInspector, 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: playerUnassignedPlayer - - Name: $v - Entry: 7 - Data: 53|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: playerUnassignedPlayer - - Name: k__BackingField - Entry: 9 - Data: 42 - - Name: k__BackingField - Entry: 9 - Data: 42 - - 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: 54|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 55|JetBrains.Annotations.PublicAPIAttribute, 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: playerUnassignedIndex - - Name: $v - Entry: 7 - Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: playerUnassignedIndex - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 9 - Data: 13 - - 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: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 58|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 59|UnityEngine.HideInInspector, 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: playerUnassignedPoolObject - - Name: $v - Entry: 7 - Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: playerUnassignedPoolObject - - Name: k__BackingField - Entry: 9 - Data: 24 - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 2 - - Name: - Entry: 7 - Data: 62|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 63|UnityEngine.HideInInspector, 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: - - Name: - Entry: 8 - Data: diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.asset.meta b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.asset.meta deleted file mode 100644 index 4ef132c..0000000 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 60d3e5d5021602c47abc7f97b673f172 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.cs b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.cs index c71432e..58e4256 100644 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.cs +++ b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPoolEventListener.cs @@ -5,8 +5,17 @@ namespace TLP.UdonUtils.Runtime.Adapters.Cyan { - public class CyanPoolEventListener : TlpBaseBehaviour + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(CyanPoolEventListener), ExecutionOrder)] + public abstract class CyanPoolEventListener : TlpBaseBehaviour { + + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = CyanPooledObject.ExecutionOrder + 1; + + /// /// This event is called when the local player's pool object has been assigned. /// diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.asset b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.asset deleted file mode 100644 index c75e9f1..0000000 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.asset +++ /dev/null @@ -1,758 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} - m_Name: CyanPooledObject - m_EditorClassIdentifier: - serializedUdonProgramAsset: {fileID: 11400000, guid: ba00cf80547953541bc33f9d1b33cfec, - type: 2} - udonAssembly: - assemblyError: - sourceCsScript: {fileID: 11500000, guid: 321691466c540cf40b4d1e70bb5674ea, type: 3} - scriptVersion: 2 - compiledVersion: 2 - behaviourSyncMode: 0 - hasInteractEvent: 0 - scriptID: 8873734069264360041 - serializationData: - SerializedFormat: 2 - SerializedBytes: - ReferencedUnityObjects: [] - SerializedBytesString: - Prefab: {fileID: 0} - PrefabModificationsReferencedUnityObjects: [] - PrefabModifications: [] - SerializationNodes: - - Name: fieldDefinitions - Entry: 7 - Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, - UdonSharp.Editor]], mscorlib - - Name: comparer - Entry: 7 - Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, - mscorlib]], mscorlib - - Name: - Entry: 8 - Data: - - Name: - Entry: 12 - Data: 11 - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: $v - Entry: 7 - Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: k__BackingField - Entry: 7 - Data: 3|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Boolean, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Networking - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: If true and a serialization request fails it will automatically try to - send again in the next frame until it succeeds. Only applies to owned objects - and manual sync. - - 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: PauseSynchronization - - Name: $v - Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PauseSynchronization - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Has no effect unless implemented by this particular script. See SyncPaused - property for details. - - 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: Severity - - Name: $v - Entry: 7 - Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Severity - - Name: k__BackingField - Entry: 7 - Data: 12|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 13|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Int32, mscorlib - - Name: - Entry: 8 - Data: - - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Logging - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: 'What kind of logs of this behavior shall be produced. Selected severity - includes all more severe levels. Example: selecting ''Warning'' also allows - ''Error'' and ''Assertion'' messages to appear. - - Note: - - ''Debug'' - messages are filtered out by default, even when selected. Add the compiler - definition ''TLP_DEBUG'' in the Unity player settings to enable them. This - should only ever be used for debugging (performance suffers)!' - - 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: PendingSerializations - - Name: $v - Entry: 7 - Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PendingSerializations - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 9 - Data: 13 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: _hadLogger - - Name: $v - Entry: 7 - Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: _hadLogger - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: k__BackingField - - Name: $v - Entry: 7 - Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: k__BackingField - - Name: k__BackingField - Entry: 7 - Data: 23|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 24|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: VRC.Udon.UdonBehaviour, VRC.Udon - - Name: - Entry: 8 - Data: - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: EventInstigator - - Name: $v - Entry: 7 - Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: EventInstigator - - Name: k__BackingField - Entry: 7 - Data: 27|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool - - Name: $v - Entry: 7 - Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Pool - - Name: k__BackingField - Entry: 9 - Data: 27 - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse - - Name: $v - Entry: 7 - Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PoolableInUse - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 40|UnityEngine.HideInInspector, 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: CyanPoolAdapter - - Name: $v - Entry: 7 - Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: CyanPoolAdapter - - Name: k__BackingField - Entry: 7 - Data: 42|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Adapters.Cyan.CyanPoolAdapter, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 44|UnityEngine.Serialization.FormerlySerializedAsAttribute, 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: Owner - - Name: $v - Entry: 7 - Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Owner - - Name: k__BackingField - Entry: 7 - Data: 46|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 46 - - 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: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 48|JetBrains.Annotations.PublicAPIAttribute, 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: - - Name: - Entry: 8 - Data: diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.asset.meta b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.asset.meta deleted file mode 100644 index 037e980..0000000 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 00671ad43173c7d4581e3b3cdd1faee9 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.cs b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.cs index eb83806..4ad3225 100644 --- a/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.cs +++ b/Packages/tlp.udonutils/Runtime/Adapters/Cyan/CyanPooledObject.cs @@ -1,11 +1,23 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Events; +using TLP.UdonUtils.Runtime.Sync; +using UnityEngine; using UnityEngine.Serialization; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Adapters.Cyan { - public class CyanPooledObject : TlpBaseBehaviour + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(CyanPooledObject), ExecutionOrder)] + public abstract class CyanPooledObject : TlpBaseBehaviour { + + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = VehicleMotionEvent.ExecutionOrder + 1; + + [FormerlySerializedAs("cyanPoolAdapter")] public CyanPoolAdapter CyanPoolAdapter; diff --git a/Packages/tlp.udonutils/Runtime/AssemblyInfo.cs b/Packages/tlp.udonutils/Runtime/AssemblyInfo.cs index 1f3ecd4..3e2505a 100644 --- a/Packages/tlp.udonutils/Runtime/AssemblyInfo.cs +++ b/Packages/tlp.udonutils/Runtime/AssemblyInfo.cs @@ -1,4 +1,4 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("TLP.UdonUtils.Tests.Editor")] -[assembly: InternalsVisibleTo("TLP.UdonUtils.Tests.Runtime")] \ No newline at end of file +[assembly: InternalsVisibleTo("TLP.UdonUtils.Tests.Runtime")] diff --git a/Packages/tlp.udonutils/Runtime/Attributes.meta b/Packages/tlp.udonutils/Runtime/Attributes.meta new file mode 100644 index 0000000..4be4fff --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Attributes.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c8d1b84753914259be24e011fed6cef1 +timeCreated: 1730292151 \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Attributes/ExecuteAfter.cs b/Packages/tlp.udonutils/Runtime/Attributes/ExecuteAfter.cs new file mode 100644 index 0000000..ae5eb2b --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Attributes/ExecuteAfter.cs @@ -0,0 +1,315 @@ +#define DEBUG_EXECUTION_ORDER + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Reflection; +using UnityEngine; + +[AttributeUsage(AttributeTargets.Class)] +public class ExecuteAfterAttribute : DefaultExecutionOrder +{ + public class Dependency + { + public int Order { get; set; } + public HashSet ExecuteAfter { get; } = new HashSet(); + } + + internal static readonly Dictionary s_HandledTypes = new Dictionary(); + + /// + /// Changes the execution order of the class it is attached to to be greater than all of the execution order values of + /// the Types provided. + /// + /// MonoBehaviour type this Attribute is attached to + /// Types of MonoBehaviours that shall execute before ownType + /// + /// Whether all SubClasses of each provided type shall also be executed before ownType. + /// Defaults to null which is interpreted as true for each given type, thus all SubClasses of given types shall be + /// executed before ownType. + /// + /// Default: true. When true ownType is guaranteed to execute after its BaseType + /// + /// When types is null or any given type is null or when a given type does not inherit + /// from MonoBehaviour + /// + public ExecuteAfterAttribute( + Type ownType, + Type[] types, + bool[] includingSubClasses = null, + bool executeAfterBaseType = true + ) : base( + DetermineOrder( + ownType, + types, + includingSubClasses, + executeAfterBaseType + ) + ) { + // nothing + } + + private static int DetermineOrder( + Type ownType, + Type[] types, + bool[] includingSubClasses, + bool executeAfterBaseType + ) { + try { + CheckArguments(ownType, types, includingSubClasses); + + // return known execution order if own type is already processed + if (s_HandledTypes.TryGetValue(ownType, out var dependency)) { + return dependency.Order; + } + + // add the own type to the processed types + dependency = new Dependency(); + s_HandledTypes.Add(ownType, dependency); + + var typesToDependOn = FindAllDirectAndIndirectDependencies( + ownType, + types, + includingSubClasses, + executeAfterBaseType + ); + + int max = 0; + foreach (var type in typesToDependOn) { + max = DetermineMaxOrderFromType(ownType, type, dependency, max); + } + + // as we want to execute AFTER the found, highest execution order value we increment by 1 + ++max; +#if DEBUG_EXECUTION_ORDER + Debug.Log($"Setting custom execution order of {ownType.Name} to {max}"); +#endif + dependency.Order = max; + return max; + } + catch (Exception e) { + // if we don't catch the exception Unity will just close without warning/error + Debug.LogException(e); + + // in that case we just return the default execution order value + return 0; + } + } + + private static int DetermineMaxOrderFromType(Type ownType, Type type, Dependency dependency, int max) { + if (ownType == type) { + // own type is not relevant for execution order determination + return max; + } + + // add type as dependency for other attributes to look up + if (!dependency.ExecuteAfter.Contains(type)) { + dependency.ExecuteAfter.Add(type); + } + + // process already handled types + if (s_HandledTypes.TryGetValue(type, out var othersDependency)) { + CheckForCyclicDependency(ownType, othersDependency, type); + max = UpdateMax(othersDependency, max); + + return max; + } + + // process not yet handled types + var customAttributes = type.GetCustomAttributes(true); + foreach (var defaultExecutionOrder in customAttributes) { + if (s_HandledTypes.TryGetValue(type, out othersDependency)) { + CheckForCyclicDependency(ownType, othersDependency, type); + max = UpdateMax(othersDependency, max); + } else { + max = UpdateMax(defaultExecutionOrder, max); + } + } + + return max; + } + + private static int UpdateMax(DefaultExecutionOrder defaultExecutionOrder, int max) { + if (defaultExecutionOrder.order > max) { + max = defaultExecutionOrder.order; + } + + return max; + } + + private static int UpdateMax(Dependency othersDependency, int max) { + if (othersDependency.Order > max) { + max = othersDependency.Order; + } + + return max; + } + + private static void CheckForCyclicDependency(Type ownType, Dependency othersDependency, Type type) { + if (othersDependency.ExecuteAfter.Contains(ownType)) { + throw new InvalidConstraintException( + $"In {nameof(ExecuteAfterAttribute)}: Cyclic dependency between {ownType.Name} and {type.Name}" + ); + } + } + + private static HashSet FindAllDirectAndIndirectDependencies( + Type ownType, + Type[] types, + bool[] includingSubClasses, + bool executeAfterBaseType + ) { + var typesToDependOn = new HashSet(); + var pending = new HashSet(); + for (int i = 0; i < types.Length; i++) { + AddSpecifiedDependencies(types, includingSubClasses, i, pending); + } + + if (executeAfterBaseType) { + AddBaseTypeAsDependency(ownType, pending); + } + + while (pending.Count > 0) { + DetermineAllDirectAndIndirectDependencies(pending, typesToDependOn); + } + + return typesToDependOn; + } + + private static void DetermineAllDirectAndIndirectDependencies( + HashSet pending, + HashSet typesToDependOn + ) { + var first = pending.First(); + if (s_HandledTypes.TryGetValue(first, out var existingEntry)) { + foreach (var type in existingEntry.ExecuteAfter) { + if (pending.Contains(type)) { + continue; + } + + if (typesToDependOn.Contains(type)) { + continue; + } + + pending.Add(type); + } + } + + if (!typesToDependOn.Contains(first)) { + typesToDependOn.Add(first); + } + + pending.Remove(first); + } + + private static void AddSpecifiedDependencies( + Type[] types, + bool[] includingSubClasses, + int i, + HashSet pending + ) { + var type = types[i]; + if (pending.Contains(type)) { + return; + } + + pending.Add(type); + + bool wantsToIncludeSubTypes = includingSubClasses == null || includingSubClasses[i]; + if (!wantsToIncludeSubTypes) { + return; + } + + AddAllRelevantSubClassesOfType(type, pending); + } + + private static void AddAllRelevantSubClassesOfType(Type type, HashSet pending) { + var subTypes = AppDomain.CurrentDomain.GetAssemblies() + .SelectMany(assembly => assembly.GetTypes()) + .Where(foundType => foundType.IsSubclassOf(type)); + foreach (var subType in subTypes) { + if (pending.Contains(subType)) { + // already added + continue; + } + + pending.Add(subType); + } + } + + private static void AddBaseTypeAsDependency(Type ownType, HashSet pending) { + var type = ownType.BaseType; + if (type == null) { + return; + } + + if (type != typeof(MonoBehaviour) && !type.IsSubclassOf(typeof(MonoBehaviour))) { + return; + } + + if (pending.Contains(type)) { + return; + } + + pending.Add(type); + } + + private static void CheckArguments(Type ownType, Type[] types, bool[] includingSubClasses) { + CheckOwnTypeValidity(ownType); + CheckDependencyDimensionValidity(ownType, types, includingSubClasses); + CheckDependencyContentValidity(ownType, types); + } + + private static void CheckDependencyContentValidity(Type ownType, Type[] types) { + foreach (var type in types) { + if (type == null) { + throw new ArgumentNullException( + $"Found on {ownType}: {nameof(types)} contains null" + ); + } + + if (type == typeof(MonoBehaviour)) { + continue; + } + + if (!type.IsSubclassOf(typeof(MonoBehaviour))) { + throw new ArgumentException( + $"Found on {ownType}: {nameof(type)} {type.Name} must inherit from {nameof(MonoBehaviour)}" + ); + } + + if (type != ownType) { + continue; + } + + throw new ArgumentException( + $"Found on {nameof(ExecuteAfterAttribute)}: {ownType.Name} can not depend on itself, skipping" + ); + } + } + + private static void CheckDependencyDimensionValidity(Type ownType, Type[] types, bool[] includingSubClasses) { + if (types == null) { + throw new ArgumentNullException($"Found on {ownType}: {nameof(types)} is null"); + } + + if (includingSubClasses == null) { + return; + } + + if (types.Length == includingSubClasses.Length) { + return; + } + + throw new ArgumentException( + $"Found on {ownType}: {nameof(includingSubClasses)} must be the same length as {nameof(types)}" + ); + } + + private static void CheckOwnTypeValidity(Type ownType) { + if (ownType == null || !ownType.IsSubclassOf(typeof(MonoBehaviour))) { + throw new ArgumentException($"{nameof(ownType)} must inherit from {nameof(MonoBehaviour)}"); + } + } +} diff --git a/Packages/tlp.udonutils/Runtime/Attributes/ExecuteAfter.cs.meta b/Packages/tlp.udonutils/Runtime/Attributes/ExecuteAfter.cs.meta new file mode 100644 index 0000000..e696669 --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Attributes/ExecuteAfter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 23d5b5868ec64650a7e61c439b790750 +timeCreated: 1730291004 \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Attributes/TlpDefaultExecutionOrder.cs b/Packages/tlp.udonutils/Runtime/Attributes/TlpDefaultExecutionOrder.cs new file mode 100644 index 0000000..2d6a04a --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Attributes/TlpDefaultExecutionOrder.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +[AttributeUsage(AttributeTargets.Class)] +public class TlpDefaultExecutionOrder : DefaultExecutionOrder +{ + private static readonly Dictionary s_executionOrders = new Dictionary(); + private static readonly HashSet s_executionOrdersByType = new HashSet(); + + private static int s_lowestFailedOrder = int.MaxValue; + + public TlpDefaultExecutionOrder(Type type, int order) : base(order) { + if (!s_executionOrdersByType.Add(type)) { + Debug.LogWarning($"Type {type} already exists"); + return; + } + + if (s_executionOrders.TryAdd(order, type)) { + return; + } + + if (order < s_lowestFailedOrder) { + s_lowestFailedOrder = order; + Debug.LogError($"ExecutionOrder value {order} of {type} is already in use by {s_executionOrders[order]}"); + return; + } + + Debug.LogWarning($"ExecutionOrder value {order} of {type} is already in use by {s_executionOrders[order]}"); + } +} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Attributes/TlpDefaultExecutionOrder.cs.meta b/Packages/tlp.udonutils/Runtime/Attributes/TlpDefaultExecutionOrder.cs.meta new file mode 100644 index 0000000..17959a9 --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/Attributes/TlpDefaultExecutionOrder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dd401993cfb9478e8d024552403de528 +timeCreated: 1730315851 \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Common/Chair.asset b/Packages/tlp.udonutils/Runtime/Common/Chair.asset index cb5fe6e..bafe7c9 100644 --- a/Packages/tlp.udonutils/Runtime/Common/Chair.asset +++ b/Packages/tlp.udonutils/Runtime/Common/Chair.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: b5d4634ba97ee0d438c3aeef64212994, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 0 + behaviourSyncMode: 2 hasInteractEvent: 1 scriptID: -8784024239004747018 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Common/Chair.cs b/Packages/tlp.udonutils/Runtime/Common/Chair.cs index 3f44e97..b7f7386 100644 --- a/Packages/tlp.udonutils/Runtime/Common/Chair.cs +++ b/Packages/tlp.udonutils/Runtime/Common/Chair.cs @@ -1,15 +1,24 @@ -using TLP.UdonUtils.Runtime.Events; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Events; using TLP.UdonUtils.Runtime.Extensions; using TLP.UdonUtils.Runtime.Sync; +using UdonSharp; using UnityEngine; using UnityEngine.Serialization; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Common { - [RequireComponent(typeof(VRC.SDK3.Components.VRCStation))] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(Chair), ExecutionOrder)] public class Chair : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = ChairProxy.ExecutionOrder + 1; + [FormerlySerializedAs("chairProxy")] [SerializeField] internal ChairProxy ChairProxy; @@ -119,7 +128,8 @@ public override void OnStationExited(VRCPlayerApi player) { return; } - if (!Assert(Utilities.IsValid(player), "Player invalid", this)) { + if (!Utilities.IsValid(player)) { + Error($"{nameof(player)} invalid"); return; } @@ -143,7 +153,6 @@ public VRCPlayerApi GetSeatedPlayer() { } #endregion - #region Local Player Events private void NotifyLocalPlayerEntered() { #if TLP_DEBUG @@ -210,7 +219,6 @@ private void NotifyRemotePlayerExited(VRCPlayerApi player) { } #endregion - #region Hook Implementations protected override bool SetupAndValidate() { if (!base.SetupAndValidate()) return false; diff --git a/Packages/tlp.udonutils/Runtime/Common/ChairProxy.asset b/Packages/tlp.udonutils/Runtime/Common/ChairProxy.asset index e422faf..2952dff 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ChairProxy.asset +++ b/Packages/tlp.udonutils/Runtime/Common/ChairProxy.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 2a2becbd1e00221419be1d42dddfb1f4, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 0 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -5584097299232269471 serializationData: @@ -635,13 +635,13 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: actualChair + Data: ActualChair - Name: $v Entry: 7 Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: actualChair + Data: ActualChair - Name: k__BackingField Entry: 7 Data: 42|System.RuntimeType, mscorlib @@ -671,10 +671,16 @@ MonoBehaviour: Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 - Data: 1 + Data: 2 + - Name: + Entry: 7 + Data: 44|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: - Name: Entry: 7 - Data: 44|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 45|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Common/ChairProxy.cs b/Packages/tlp.udonutils/Runtime/Common/ChairProxy.cs index 203606c..9e34f55 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ChairProxy.cs +++ b/Packages/tlp.udonutils/Runtime/Common/ChairProxy.cs @@ -1,22 +1,33 @@ using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Sync; +using UdonSharp; using UnityEngine; +using UnityEngine.Serialization; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Common { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(ChairProxy), ExecutionOrder)] public class ChairProxy : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpAccurateSyncBehaviour.ExecutionOrder + 100; + + [FormerlySerializedAs("actualChair")] [SerializeField] - protected Chair actualChair; + protected Chair ActualChair; [PublicAPI] public virtual bool OnLocalPlayerEntered() { #if TLP_DEBUG DebugLog(nameof(OnLocalPlayerEntered)); #endif - - if (!Assert(Utilities.IsValid(actualChair), "actualChair invalid", this)) { + if (!Utilities.IsValid(ActualChair)) { + Error($"{nameof(OnLocalPlayerEntered)}.{nameof(ActualChair)} not set"); return false; } @@ -29,12 +40,13 @@ public virtual bool OnLocalPlayerExited() { #if TLP_DEBUG DebugLog(nameof(OnLocalPlayerExited)); #endif - if (!Assert(Utilities.IsValid(actualChair), "actualChair invalid", this)) { + if (!Utilities.IsValid(ActualChair)) { + Error($"{nameof(OnLocalPlayerExited)}.{nameof(ActualChair)} not set"); return false; } var go = gameObject; - return OwnershipTransfer.TransferOwnershipFrom(go, go, Networking.GetOwner(actualChair.gameObject), true); + return OwnershipTransfer.TransferOwnershipFrom(go, go, Networking.GetOwner(ActualChair.gameObject), true); } [PublicAPI] @@ -55,7 +67,7 @@ public virtual bool OnRemotePlayerExited(VRCPlayerApi remotePlayer) { [PublicAPI] public VRCPlayerApi GetSeatedPlayer() { - return Utilities.IsValid(actualChair) ? actualChair.GetSeatedPlayer() : null; + return Utilities.IsValid(ActualChair) ? ActualChair.GetSeatedPlayer() : null; } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Common/Comparer.cs b/Packages/tlp.udonutils/Runtime/Common/Comparer.cs index f8136ca..1fc3685 100644 --- a/Packages/tlp.udonutils/Runtime/Common/Comparer.cs +++ b/Packages/tlp.udonutils/Runtime/Common/Comparer.cs @@ -5,9 +5,17 @@ namespace TLP.UdonUtils.Runtime.Common { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(Comparer), ExecutionOrder)] public abstract class Comparer : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpExecutionOrder.TimeSourcesStart + 1; + + [Tooltip("Used when the result of this Comparer object indicates no difference")] public Comparer optionalFallback; diff --git a/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.asset b/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.asset index 994e445..0a175f7 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.asset +++ b/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 043c38a532659fc43aad32967db6223e, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -6669320385205885359 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.cs b/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.cs index 509f7ec..9128d47 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.cs +++ b/Packages/tlp.udonutils/Runtime/Common/ImageDownloader.cs @@ -1,5 +1,7 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.DesignPatterns.MVC; using TLP.UdonUtils.Runtime.Extensions; +using TLP.UdonUtils.Runtime.Player; using UdonSharp; using UnityEngine; using UnityEngine.UI; @@ -11,15 +13,16 @@ namespace TLP.UdonUtils.Runtime.Common { [DisallowMultipleComponent] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [TlpDefaultExecutionOrder(typeof(ImageDownloader), ExecutionOrder)] public class ImageDownloader : TlpBaseBehaviour { #region Executionorder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.UiStart + 1; + public new const int ExecutionOrder = Controller.ExecutionOrder + 1; #endregion [SerializeField] @@ -329,7 +332,10 @@ private void StartDownload() { #endif #endregion - Assert(Utilities.IsValid(_imageDownloader), $"{nameof(_imageDownloader)} invalid", this); + if (!Utilities.IsValid(_imageDownloader)) { + Error($"{nameof(_imageDownloader)} invalid"); + return; + } _imageDownload = _imageDownloader.DownloadImage( ImageUrls[_currentImageIndex], diff --git a/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.asset b/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.asset index 27247fa..5178cca 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.asset +++ b/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: c07db1ccb93a9854d8e1da1720df755a, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -1631318615785128359 serializationData: @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 1 + Data: 10 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: prefab + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: prefab + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: UnityEngine.GameObject, UnityEngine.CoreModule + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -84,6 +84,591 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: _hadLogger + - Name: $v + Entry: 7 + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _hadLogger + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator + - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: prefab + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: prefab + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.GameObject, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.cs b/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.cs index 15c4458..78267a1 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.cs +++ b/Packages/tlp.udonutils/Runtime/Common/ObjectSpawner.cs @@ -1,14 +1,25 @@ -using TLP.UdonUtils.Runtime.Player; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Player; +using TLP.UdonUtils.Runtime.Sync; +using TLP.UdonUtils.Runtime.Sync.SyncedEvents; using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Common { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] - public class ObjectSpawner : UdonSharpBehaviour + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(ObjectSpawner), ExecutionOrder)] + public class ObjectSpawner : TlpBaseBehaviour { - public void Start() { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = RoundRobinSynchronizer.ExecutionOrder + 1; + + public override void Start() { + base.Start(); int playersCount = VRCPlayerApi.GetPlayerCount(); var players = new VRCPlayerApi[playersCount]; foreach (var vrcPlayerApi in VRCPlayerApi.GetPlayers(players)) { diff --git a/Packages/tlp.udonutils/Runtime/Common/ToggleObject.asset b/Packages/tlp.udonutils/Runtime/Common/ToggleObject.asset index 12ca415..b9b74dc 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ToggleObject.asset +++ b/Packages/tlp.udonutils/Runtime/Common/ToggleObject.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 808f76e33e4175f48be721050d89cc68, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 0 + behaviourSyncMode: 2 hasInteractEvent: 1 scriptID: -795238795713000860 serializationData: @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 4 + Data: 13 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: activationSound + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: activationSound + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: UnityEngine.AudioSource, UnityEngine.AudioModule + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -84,6 +84,231 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -104,19 +329,379 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: deactivationSound + Data: _hadLogger - Name: $v Entry: 7 - Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: deactivationSound + Data: _hadLogger + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 - Name: k__BackingField Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: activationSound + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: activationSound + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.AudioSource, UnityEngine.AudioModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: deactivationSound + - Name: $v + Entry: 7 + Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: deactivationSound + - Name: k__BackingField + Entry: 9 + Data: 42 + - Name: k__BackingField + Entry: 9 + Data: 42 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -131,7 +716,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 6|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 45|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -155,13 +740,13 @@ MonoBehaviour: Data: gameobjectToggle - Name: $v Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: gameobjectToggle - Name: k__BackingField Entry: 7 - Data: 8|System.RuntimeType, mscorlib + Data: 47|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.KeyCode, UnityEngine.CoreModule @@ -170,7 +755,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 8 + Data: 47 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -185,7 +770,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 9|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 @@ -209,13 +794,13 @@ MonoBehaviour: Data: gameObjectToToggle - Name: $v Entry: 7 - Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: gameObjectToToggle - Name: k__BackingField Entry: 7 - Data: 11|System.RuntimeType, mscorlib + Data: 50|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.GameObject, UnityEngine.CoreModule @@ -224,7 +809,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 11 + Data: 50 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -239,7 +824,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 12|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 diff --git a/Packages/tlp.udonutils/Runtime/Common/ToggleObject.cs b/Packages/tlp.udonutils/Runtime/Common/ToggleObject.cs index 70f8afd..3f98ffa 100644 --- a/Packages/tlp.udonutils/Runtime/Common/ToggleObject.cs +++ b/Packages/tlp.udonutils/Runtime/Common/ToggleObject.cs @@ -1,11 +1,22 @@ -using UdonSharp; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Recording; +using TLP.UdonUtils.Runtime.Sync; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Common { - public class ToggleObject : UdonSharpBehaviour + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(ToggleObject), ExecutionOrder)] + public class ToggleObject : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TransformBacklog.ExecutionOrder + 1; + public AudioSource activationSound; public AudioSource deactivationSound; diff --git a/Packages/tlp.udonutils/Runtime/Common/UdonCommon.cs b/Packages/tlp.udonutils/Runtime/Common/UdonCommon.cs index 2641f93..918b042 100644 --- a/Packages/tlp.udonutils/Runtime/Common/UdonCommon.cs +++ b/Packages/tlp.udonutils/Runtime/Common/UdonCommon.cs @@ -1,5 +1,4 @@ using System; -using JetBrains.Annotations; using UdonSharp; using UnityEngine; using VRC.SDK3.Data; diff --git a/Packages/tlp.udonutils/Runtime/Common/WorldVersionCheck.cs b/Packages/tlp.udonutils/Runtime/Common/WorldVersionCheck.cs index ca662cd..cacd349 100644 --- a/Packages/tlp.udonutils/Runtime/Common/WorldVersionCheck.cs +++ b/Packages/tlp.udonutils/Runtime/Common/WorldVersionCheck.cs @@ -1,7 +1,6 @@ using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Events; using TLP.UdonUtils.Runtime.Extensions; -using TLP.UdonUtils.Runtime.Logger; using UdonSharp; using UnityEngine; using UnityEngine.Serialization; @@ -19,12 +18,13 @@ namespace TLP.UdonUtils.Runtime.Common /// [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(WorldVersionCheck), ExecutionOrder)] public class WorldVersionCheck : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpLogger.ExecutionOrder + 1; + public new const int ExecutionOrder = TlpExecutionOrder.WorldInitStart + 1; #region State diff --git a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Controller.cs b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Controller.cs index ae0aead..d6214a6 100644 --- a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Controller.cs +++ b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Controller.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDKBase; @@ -12,12 +13,13 @@ namespace TLP.UdonUtils.Runtime.DesignPatterns.MVC /// The controller also handles any business logic related to user input. /// [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(Controller), ExecutionOrder)] public abstract class Controller : MvcBase { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = Model.ExecutionOrder + 1; + public new const int ExecutionOrder = Model.ExecutionOrder + 100; public bool Initialized { get; private set; } protected Model Model { get; private set; } diff --git a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/DummyView.cs b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/DummyView.cs index 3e0a718..583e078 100644 --- a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/DummyView.cs +++ b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/DummyView.cs @@ -1,10 +1,19 @@ +using JetBrains.Annotations; using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.DesignPatterns.MVC { [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(DummyView), ExecutionOrder)] public class DummyView : View { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = View.ExecutionOrder + 1; + public override void OnModelChanged() { } } diff --git a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Model.cs b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Model.cs index 38ff5bc..5960788 100644 --- a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Model.cs +++ b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/Model.cs @@ -1,19 +1,21 @@ using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Events; +using TLP.UdonUtils.Runtime.Player; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.DesignPatterns.MVC { [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(Model), ExecutionOrder)] public abstract class Model : MvcBase { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.UiStart; + public new const int ExecutionOrder = MvcBase.ExecutionOrder + 1; #endregion #region Constants diff --git a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/MvcBase.cs b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/MvcBase.cs index 03ed6f4..b2c85a8 100644 --- a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/MvcBase.cs +++ b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/MvcBase.cs @@ -1,12 +1,21 @@ +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Events; +using TLP.UdonUtils.Runtime.Player; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.DesignPatterns.MVC { + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(MvcBase), ExecutionOrder)] public abstract class MvcBase : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = PlayerFollowerUi.ExecutionOrder + 100; + public string CriticalError { get; protected set; } public bool HasError { get; protected set; } diff --git a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/View.cs b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/View.cs index 95c5fd2..dbad948 100644 --- a/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/View.cs +++ b/Packages/tlp.udonutils/Runtime/DesignPatterns/MVC/View.cs @@ -6,12 +6,13 @@ namespace TLP.UdonUtils.Runtime.DesignPatterns.MVC { [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(View), ExecutionOrder)] public abstract class View : MvcBase { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = Controller.ExecutionOrder + 1; + public new const int ExecutionOrder = Controller.ExecutionOrder + 100; public bool Initialized { get; private set; } public Model Model { get; private set; } diff --git a/Packages/tlp.udonutils/Runtime/EditorOnly/AssemblyInfo.cs b/Packages/tlp.udonutils/Runtime/EditorOnly/AssemblyInfo.cs new file mode 100644 index 0000000..e27113f --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/EditorOnly/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("TLP.UdonUtils.Tests.Editor")] diff --git a/Packages/tlp.udonutils/Runtime/EditorOnly/AssemblyInfo.cs.meta b/Packages/tlp.udonutils/Runtime/EditorOnly/AssemblyInfo.cs.meta new file mode 100644 index 0000000..169e681 --- /dev/null +++ b/Packages/tlp.udonutils/Runtime/EditorOnly/AssemblyInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b14fd786f4724b0483835fd372360d1b +timeCreated: 1730291238 \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/EditorOnly/MockController.cs b/Packages/tlp.udonutils/Runtime/EditorOnly/MockController.cs index 999dc5f..9e85e90 100644 --- a/Packages/tlp.udonutils/Runtime/EditorOnly/MockController.cs +++ b/Packages/tlp.udonutils/Runtime/EditorOnly/MockController.cs @@ -1,9 +1,21 @@ +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.DesignPatterns.MVC; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.EditorOnly { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(MockController), ExecutionOrder)] public class MockController : Controller { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = View.ExecutionOrder - 1; + + public bool InitResult = true; public bool DeInitResult = true; diff --git a/Packages/tlp.udonutils/Runtime/EditorOnly/MockEvent.cs b/Packages/tlp.udonutils/Runtime/EditorOnly/MockEvent.cs index 384f624..51939e3 100644 --- a/Packages/tlp.udonutils/Runtime/EditorOnly/MockEvent.cs +++ b/Packages/tlp.udonutils/Runtime/EditorOnly/MockEvent.cs @@ -1,12 +1,23 @@ #if !COMPILER_UDONSHARP && UNITY_EDITOR +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Events; +using UdonSharp; +using UnityEngine; using UnityEngine.Serialization; using VRC.Udon.Common.Enums; namespace TLP.UdonUtils.Runtime.EditorOnly { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(MockEvent), ExecutionOrder)] public class MockEvent : UdonEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = UdonEvent.ExecutionOrder + 99; + public TlpBaseBehaviour Caller; public TlpBaseBehaviour RaiseOnIdleInstigator { get; private set; } public int RaiseOnIdleIdleFrames { get; private set; } diff --git a/Packages/tlp.udonutils/Runtime/EditorOnly/MockModel.cs b/Packages/tlp.udonutils/Runtime/EditorOnly/MockModel.cs index cd9c789..c2fd7b8 100644 --- a/Packages/tlp.udonutils/Runtime/EditorOnly/MockModel.cs +++ b/Packages/tlp.udonutils/Runtime/EditorOnly/MockModel.cs @@ -1,9 +1,22 @@ +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.DesignPatterns.MVC; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.EditorOnly { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(MockModel), ExecutionOrder)] public class MockModel : Model { + + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = Controller.ExecutionOrder -1; + + public bool InitResult = true; public bool DeInitResult = true; diff --git a/Packages/tlp.udonutils/Runtime/EditorOnly/MockView.cs b/Packages/tlp.udonutils/Runtime/EditorOnly/MockView.cs index 449b415..2c23b1c 100644 --- a/Packages/tlp.udonutils/Runtime/EditorOnly/MockView.cs +++ b/Packages/tlp.udonutils/Runtime/EditorOnly/MockView.cs @@ -1,9 +1,20 @@ +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.DesignPatterns.MVC; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.EditorOnly { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(MockView), ExecutionOrder)] public class MockView : View { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = View.ExecutionOrder + 99; + public bool InitResult = true; public bool DeInitResult = true; public int ModelChangedInvocations; diff --git a/Packages/tlp.udonutils/Runtime/Events/AudioEvent.cs b/Packages/tlp.udonutils/Runtime/Events/AudioEvent.cs index 0ff3127..0c8669b 100644 --- a/Packages/tlp.udonutils/Runtime/Events/AudioEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Events/AudioEvent.cs @@ -1,14 +1,17 @@ using JetBrains.Annotations; +using UdonSharp; using UnityEngine; namespace TLP.UdonUtils.Runtime.Events { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(AudioEvent), ExecutionOrder)] public class AudioEvent : UdonEvent { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.AudioStart; + public new const int ExecutionOrder = TlpExecutionOrder.AudioStart + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Events/DirectInputEvent.cs b/Packages/tlp.udonutils/Runtime/Events/DirectInputEvent.cs index c723b8d..6806638 100644 --- a/Packages/tlp.udonutils/Runtime/Events/DirectInputEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Events/DirectInputEvent.cs @@ -4,13 +4,14 @@ namespace TLP.UdonUtils.Runtime.Events { - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(DirectInputEvent), ExecutionOrder)] public class DirectInputEvent : UdonEvent { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DirectInputStart; + public new const int ExecutionOrder = TlpExecutionOrder.DirectInputStart + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Events/ExampleEventListener.cs b/Packages/tlp.udonutils/Runtime/Events/ExampleEventListener.cs index 0336b52..aec6891 100644 --- a/Packages/tlp.udonutils/Runtime/Events/ExampleEventListener.cs +++ b/Packages/tlp.udonutils/Runtime/Events/ExampleEventListener.cs @@ -1,10 +1,18 @@ -using System; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; namespace TLP.UdonUtils.Runtime.Events { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(ExampleEventListener), ExecutionOrder)] public class ExampleEventListener : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = StateMachine.StateMachineBehaviour.ExecutionOrder + 100; [SerializeField] private UdonEvent UdonEvent; diff --git a/Packages/tlp.udonutils/Runtime/Events/PlayerMotionEvent.cs b/Packages/tlp.udonutils/Runtime/Events/PlayerMotionEvent.cs index 69f4ed8..38aa25f 100644 --- a/Packages/tlp.udonutils/Runtime/Events/PlayerMotionEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Events/PlayerMotionEvent.cs @@ -4,13 +4,14 @@ namespace TLP.UdonUtils.Runtime.Events { - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(PlayerMotionEvent), ExecutionOrder)] public class PlayerMotionEvent : UdonEvent { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.PlayerMotionStart; + public new const int ExecutionOrder = TlpExecutionOrder.PlayerMotionStart + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Events/UdonEvent.cs b/Packages/tlp.udonutils/Runtime/Events/UdonEvent.cs index 9cb03a3..02e9584 100644 --- a/Packages/tlp.udonutils/Runtime/Events/UdonEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Events/UdonEvent.cs @@ -8,14 +8,15 @@ namespace TLP.UdonUtils.Runtime.Events { - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(UdonEvent), ExecutionOrder)] public class UdonEvent : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultStart + 1; + public new const int ExecutionOrder = TlpBaseBehaviour.ExecutionOrder + 1; private const int InvalidInvocationFrame = -1; private const int InvalidIndex = -1; diff --git a/Packages/tlp.udonutils/Runtime/Events/UiEvent.asset b/Packages/tlp.udonutils/Runtime/Events/UiEvent.asset index e62a1b6..6694f41 100644 --- a/Packages/tlp.udonutils/Runtime/Events/UiEvent.asset +++ b/Packages/tlp.udonutils/Runtime/Events/UiEvent.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: f95147634bfd42ba8c41c9183e88e2bf, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -2691533232995813866 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Events/UiEvent.cs b/Packages/tlp.udonutils/Runtime/Events/UiEvent.cs index 3ca8540..895d054 100644 --- a/Packages/tlp.udonutils/Runtime/Events/UiEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Events/UiEvent.cs @@ -1,11 +1,17 @@ +using JetBrains.Annotations; using UdonSharp; using UnityEngine; namespace TLP.UdonUtils.Runtime.Events { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [TlpDefaultExecutionOrder(typeof(UiEvent), ExecutionOrder)] public class UiEvent : UdonEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpExecutionOrder.UiStart + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Events/VehicleMotionEvent.cs b/Packages/tlp.udonutils/Runtime/Events/VehicleMotionEvent.cs index 71e8d5a..97a9177 100644 --- a/Packages/tlp.udonutils/Runtime/Events/VehicleMotionEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Events/VehicleMotionEvent.cs @@ -4,13 +4,14 @@ namespace TLP.UdonUtils.Runtime.Events { - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(VehicleMotionEvent), ExecutionOrder)] public class VehicleMotionEvent : UdonEvent { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.VehicleMotionStart; + public new const int ExecutionOrder = TlpExecutionOrder.VehicleMotionStart + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Events/WeaponsEvent.cs b/Packages/tlp.udonutils/Runtime/Events/WeaponsEvent.cs index 21217cf..59c61c2 100644 --- a/Packages/tlp.udonutils/Runtime/Events/WeaponsEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Events/WeaponsEvent.cs @@ -4,13 +4,14 @@ namespace TLP.UdonUtils.Runtime.Events { - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(WeaponsEvent), ExecutionOrder)] public class WeaponsEvent : UdonEvent { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.WeaponsStart; + public new const int ExecutionOrder = TlpExecutionOrder.WeaponsStart + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.asset b/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.asset index 1eae6c1..00c4299 100644 --- a/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.asset +++ b/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 28542c9be8bb20e4d8ddb38799c4e733, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -5710663935001640462 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.cs b/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.cs index d07949d..46cc0cd 100644 --- a/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.cs +++ b/Packages/tlp.udonutils/Runtime/Examples/WorldVersionEventListener.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Events; using TMPro; using UdonSharp; @@ -10,9 +11,16 @@ namespace TLP.UdonUtils.Runtime.Examples /// /// Example of a UdonBehaviour that can get notified when a player with a different world version joined. /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(WorldVersionEventListener), ExecutionOrder)] public class WorldVersionEventListener : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = WorldVersionCheck.ExecutionOrder + 1; + #region Dependencies public Canvas Canvas; public TextMeshProUGUI UpdateAvailableText; diff --git a/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.asset b/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.asset index 412766a..d01843c 100644 --- a/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.asset +++ b/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: c3e7d4d247de447fae6fd13ba364cb2f, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -456100270373304085 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.cs b/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.cs index c75beb4..d55a19e 100644 --- a/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.cs +++ b/Packages/tlp.udonutils/Runtime/Factories/InstantiatingFactory.cs @@ -1,4 +1,5 @@ -using TLP.UdonUtils.Runtime.Common; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; using UdonSharp; using UnityEngine; using VRC.SDKBase; @@ -8,9 +9,16 @@ namespace TLP.UdonUtils.Runtime.Factories /// /// Factory that creates new clones of a provided GameObject with on it. /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(InstantiatingFactory), ExecutionOrder)] public class InstantiatingFactory : TlpFactory { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpFactory.ExecutionOrder + 1; + [Tooltip("What type of Component with GameObject to instantiate")] public UdonSharpBehaviour Prototype; diff --git a/Packages/tlp.udonutils/Runtime/Factories/TlpFactory.cs b/Packages/tlp.udonutils/Runtime/Factories/TlpFactory.cs index 21aeaf0..c0b42ed 100644 --- a/Packages/tlp.udonutils/Runtime/Factories/TlpFactory.cs +++ b/Packages/tlp.udonutils/Runtime/Factories/TlpFactory.cs @@ -2,20 +2,22 @@ using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Logger; +using TLP.UdonUtils.Runtime.Sync.SyncedEvents; using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Factories { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TlpFactory), ExecutionOrder)] public abstract class TlpFactory : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultStart; + public new const int ExecutionOrder = ObjectSpawner.ExecutionOrder + 1; public const string FactoriesGameObjectName = "TLP_Factories"; diff --git a/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.asset b/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.asset index abc381a..5581824 100644 --- a/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.asset +++ b/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 43266f688d95c0340a72883e181fea7a, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 201849014767930698 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.cs b/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.cs index fc629ff..803cf36 100644 --- a/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.cs +++ b/Packages/tlp.udonutils/Runtime/Logger/TlpLogger.cs @@ -23,21 +23,21 @@ public enum ELogLevel Debug = 5 } - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TlpLogger), ExecutionOrder)] public class TlpLogger : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.Min; + public new const int ExecutionOrder = TlpExecutionOrder.Min + 1; #region Dependencies public TimeSource TimeSource; public FrameCountSource FrameCount; #endregion - #region Settings public bool DetailedPlayerInfo = true; public bool DetailedContextInfo = true; @@ -87,6 +87,7 @@ public void OnEnable() { if (gameObject.name == expectedName) { return; } + Warn(Prefix, $"Changing name of GameObject '{transform.GetPathInScene()}' to '{expectedName}'", this); gameObject.name = expectedName; } @@ -97,7 +98,8 @@ public void Update() { public string DebugLogOfFrame { get; private set; } - protected virtual string Prefix => "[TLP]"; + public const string DefaultPrefix = "[TLP]"; + protected virtual string Prefix => DefaultPrefix; protected virtual string GetPlayerInfo(Object context) { if (!DetailedPlayerInfo) { @@ -257,5 +259,25 @@ private bool AllowedToLog(Object context) { (RuntimeBlackList.Count == 0 || !RuntimeBlackList.ContainsKey(context)); } #endregion + + #region Static Log Functions + public static void StaticDebugLog(string message, Type type, Object context = null) { +#if TLP_DEBUG + Debug.Log($"[DEBUG]{DefaultPrefix}[{type}] {message}", context); +#endif + } + + public static void StaticInfo(string message, Type type, Object context = null) { + Debug.Log($"[INFO]{DefaultPrefix}[{type}] {message}", context); + } + + public static void StaticWarning(string message, Type type, Object context = null) { + Debug.LogWarning($"[WARN]{DefaultPrefix}[{type}] {message}", context); + } + + public static void StaticError(string message, Type type, Object context = null) { + Debug.LogError($"[ERROR]{DefaultPrefix}[{type}] {message}", context); + } + #endregion } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Physics/CenterOfMass.cs b/Packages/tlp.udonutils/Runtime/Physics/CenterOfMass.cs index e334ea2..338e369 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/CenterOfMass.cs +++ b/Packages/tlp.udonutils/Runtime/Physics/CenterOfMass.cs @@ -1,12 +1,22 @@ -using UdonSharp; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; +using TLP.UdonUtils.Runtime.Recording; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Physics { [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] - public class CenterOfMass : UdonSharpBehaviour + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(CenterOfMass), ExecutionOrder)] + public class CenterOfMass : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = ToggleObject.ExecutionOrder + 1; + [SerializeField] private Rigidbody body; @@ -27,7 +37,8 @@ public void OnEnable() { enabled = false; } - public void Start() { + public override void Start() { + base.Start(); OnEnable(); } diff --git a/Packages/tlp.udonutils/Runtime/Physics/ConstantLinearVelocity.cs b/Packages/tlp.udonutils/Runtime/Physics/ConstantLinearVelocity.cs index b856993..a70fe3b 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/ConstantLinearVelocity.cs +++ b/Packages/tlp.udonutils/Runtime/Physics/ConstantLinearVelocity.cs @@ -2,7 +2,7 @@ namespace TLP.UdonUtils.Runtime.Physics { - public class ConstantLinearVelocity + public static class ConstantLinearVelocity { /// /// s(t) = v * t + s_0 diff --git a/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset b/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset index f798744..aafa5cf 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset +++ b/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: ffa63bdd7cb2446a8e0ff690d5c39c41, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 2945114219428092478 serializationData: @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 25 + Data: 19 - Name: Entry: 7 Data: @@ -987,342 +987,12 @@ MonoBehaviour: - Name: Entry: 7 Data: - - Name: $k - Entry: 1 - Data: DebugVelocity - - Name: $v - Entry: 7 - Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugVelocity - - Name: k__BackingField - Entry: 7 - Data: 59|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Single, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 61|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: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 64|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: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 67|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: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 69|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 70|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: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeVelocity - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 73|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: 74|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeAcceleration - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 75|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 76|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: 77|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _position @@ -1346,7 +1016,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 78|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1370,7 +1040,7 @@ MonoBehaviour: Data: ToTrack - Name: $v Entry: 7 - Data: 79|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: ToTrack @@ -1394,13 +1064,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 80|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 81|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 62|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -1424,13 +1094,13 @@ MonoBehaviour: Data: TimeSource - Name: $v Entry: 7 - Data: 82|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: TimeSource - Name: k__BackingField Entry: 7 - Data: 83|System.RuntimeType, mscorlib + Data: 64|System.RuntimeType, mscorlib - Name: Entry: 1 Data: TLP.UdonUtils.Runtime.Sources.TimeSource, TLP.UdonUtils.Runtime @@ -1454,13 +1124,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 84|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 65|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 85|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 66|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.cs b/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.cs index 5c75350..7814ece 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.cs +++ b/Packages/tlp.udonutils/Runtime/Physics/FixedUpdateVelocityProvider.cs @@ -1,3 +1,4 @@ +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Sources; using UdonSharp; using UnityEngine; @@ -8,10 +9,16 @@ namespace TLP.UdonUtils.Runtime.Physics /// calculates velocity and acceleration after everything that can affect locations and physics of objects which /// should be everything except audio /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(FixedUpdateVelocityProvider), ExecutionOrder)] public class FixedUpdateVelocityProvider : VelocityProvider { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = VelocityProvider.ExecutionOrder + 1; + private readonly Vector3[] _position = new Vector3[3]; #region Dependencies diff --git a/Packages/tlp.udonutils/Runtime/Physics/InertiaTensor.cs b/Packages/tlp.udonutils/Runtime/Physics/InertiaTensor.cs index 00ef797..07c8720 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/InertiaTensor.cs +++ b/Packages/tlp.udonutils/Runtime/Physics/InertiaTensor.cs @@ -1,12 +1,20 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Physics { [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] - public class InertiaTensor : UdonSharpBehaviour + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(InertiaTensor), ExecutionOrder)] + public class InertiaTensor : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = CenterOfMass.ExecutionOrder + 1; + [SerializeField] private Rigidbody body; @@ -23,7 +31,8 @@ public void OnEnable() { enabled = false; } - public void Start() { + public override void Start() { + base.Start(); OnEnable(); } diff --git a/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset b/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset index d3de92e..f16ace9 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset +++ b/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: cc5ed0873fb545e29c225728f3d40ca3, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 1296714989510850518 serializationData: @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 25 + Data: 19 - Name: Entry: 7 Data: @@ -987,342 +987,12 @@ MonoBehaviour: - Name: Entry: 7 Data: - - Name: $k - Entry: 1 - Data: DebugVelocity - - Name: $v - Entry: 7 - Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugVelocity - - Name: k__BackingField - Entry: 7 - Data: 59|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Single, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 61|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: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 64|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: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 67|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: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 69|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 70|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: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeVelocity - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 73|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: 74|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeAcceleration - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 75|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 76|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: 77|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: ToTrack @@ -1346,13 +1016,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 78|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 79|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 60|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -1376,7 +1046,7 @@ MonoBehaviour: Data: _position - Name: $v Entry: 7 - Data: 80|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _position @@ -1400,7 +1070,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 81|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 62|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1424,13 +1094,13 @@ MonoBehaviour: Data: _positionTime - Name: $v Entry: 7 - Data: 82|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _positionTime - Name: k__BackingField Entry: 7 - Data: 83|System.RuntimeType, mscorlib + Data: 64|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Single[], mscorlib @@ -1439,7 +1109,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 83 + Data: 64 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1454,7 +1124,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 84|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 65|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.cs b/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.cs index 135d850..fe41a15 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.cs +++ b/Packages/tlp.udonutils/Runtime/Physics/PostLateUpdateVelocityProvider.cs @@ -1,16 +1,22 @@ +using JetBrains.Annotations; using UdonSharp; using UnityEngine; namespace TLP.UdonUtils.Runtime.Physics { /// - /// calculates velocity and acceleration after everything that can affect locations and physics of objects which - /// should be everything except audio + /// calculates velocity and acceleration after everything that can affect locations /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(PostLateUpdateVelocityProvider), ExecutionOrder)] public class PostLateUpdateVelocityProvider : VelocityProvider { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = RigidbodyVelocityProvider.ExecutionOrder + 1; + [SerializeField] private Transform ToTrack; diff --git a/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset b/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset index 45cb2d0..9068909 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset +++ b/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: e945adb2fe954e1c839e25603bb97463, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -1565615156217026730 serializationData: @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 28 + Data: 22 - Name: Entry: 7 Data: @@ -989,19 +989,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: DebugVelocity + Data: ToTrack - Name: $v Entry: 7 Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: DebugVelocity + Data: ToTrack - Name: k__BackingField Entry: 7 Data: 59|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: System.Single, mscorlib + Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule - Name: Entry: 8 Data: @@ -1023,336 +1023,6 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 61|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: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 64|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: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs2x - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 67|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: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAccelerationInGs3x - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 69|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 70|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: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeVelocity - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 73|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: 74|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: DebugAgeAcceleration - - Name: k__BackingField - Entry: 9 - Data: 59 - - Name: k__BackingField - Entry: 9 - Data: 59 - - 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: 75|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 76|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: 77|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: ToTrack - - Name: k__BackingField - Entry: 7 - Data: 78|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Rigidbody, UnityEngine.PhysicsModule - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 78 - - 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: 79|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1376,13 +1046,13 @@ MonoBehaviour: Data: TimeSource - Name: $v Entry: 7 - Data: 80|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: TimeSource - Name: k__BackingField Entry: 7 - Data: 81|System.RuntimeType, mscorlib + Data: 62|System.RuntimeType, mscorlib - Name: Entry: 1 Data: TLP.UdonUtils.Runtime.Sources.TimeSource, TLP.UdonUtils.Runtime @@ -1406,13 +1076,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 82|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 83|UnityEngine.SerializeField, UnityEngine.CoreModule + Data: 64|UnityEngine.SerializeField, UnityEngine.CoreModule - Name: Entry: 8 Data: @@ -1436,16 +1106,22 @@ MonoBehaviour: Data: CircularTurnThreshold - Name: $v Entry: 7 - Data: 84|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: CircularTurnThreshold - Name: k__BackingField - Entry: 9 - Data: 59 + Entry: 7 + Data: 66|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Single, mscorlib + - Name: + Entry: 8 + Data: - Name: k__BackingField Entry: 9 - Data: 59 + Data: 66 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1460,13 +1136,13 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 85|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 2 - Name: Entry: 7 - Data: 86|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + Data: 68|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - Name: tooltip Entry: 1 Data: Turnrate in degrees/second considered circular movement. Lower values @@ -1476,7 +1152,7 @@ MonoBehaviour: Data: - Name: Entry: 7 - Data: 87|UnityEngine.RangeAttribute, UnityEngine.CoreModule + Data: 69|UnityEngine.RangeAttribute, UnityEngine.CoreModule - Name: min Entry: 4 Data: 5 @@ -1506,16 +1182,16 @@ MonoBehaviour: Data: _circleTurnRate - Name: $v Entry: 7 - Data: 88|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _circleTurnRate - Name: k__BackingField Entry: 9 - Data: 59 + Data: 66 - Name: k__BackingField Entry: 9 - Data: 59 + Data: 66 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1530,7 +1206,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 89|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 71|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1554,13 +1230,13 @@ MonoBehaviour: Data: _position - Name: $v Entry: 7 - Data: 90|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 72|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _position - Name: k__BackingField Entry: 7 - Data: 91|System.RuntimeType, mscorlib + Data: 73|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Vector3, UnityEngine.CoreModule @@ -1569,7 +1245,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 91 + Data: 73 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1584,7 +1260,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 92|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 74|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -1608,13 +1284,13 @@ MonoBehaviour: Data: _rotation - Name: $v Entry: 7 - Data: 93|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _rotation - Name: k__BackingField Entry: 7 - Data: 94|System.RuntimeType, mscorlib + Data: 76|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Quaternion, UnityEngine.CoreModule @@ -1623,7 +1299,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 94 + Data: 76 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1638,7 +1314,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 95|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 77|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.cs b/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.cs index 6fc6326..04f337f 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.cs +++ b/Packages/tlp.udonutils/Runtime/Physics/RigidbodyVelocityProvider.cs @@ -1,7 +1,9 @@ +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Extensions; using TLP.UdonUtils.Runtime.Sources; using UdonSharp; using UnityEngine; +using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Physics { @@ -9,10 +11,15 @@ namespace TLP.UdonUtils.Runtime.Physics /// uses rigidbody velocity and calculates acceleration after everything that can affect physics of objects which /// should be everything except audio /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(RigidbodyVelocityProvider), ExecutionOrder)] public class RigidbodyVelocityProvider : VelocityProvider { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = FixedUpdateVelocityProvider.ExecutionOrder + 1; #region Dependencies public Rigidbody ToTrack; @@ -133,5 +140,25 @@ double time _position = RelativeTo.InverseTransformPoint(worldPosition); } #endregion + + #region Overrides + protected override bool SetupAndValidate() { + if (!base.SetupAndValidate()) { + return false; + } + + if (!Utilities.IsValid(ToTrack)) { + Error($"{nameof(ToTrack)} not set"); + return false; + } + + if (!Utilities.IsValid(TimeSource)) { + Error($"{nameof(TimeSource)} not set"); + return false; + } + + return true; + } + #endregion } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Physics/VelocityProvider.cs b/Packages/tlp.udonutils/Runtime/Physics/VelocityProvider.cs index 4b0f163..925648e 100644 --- a/Packages/tlp.udonutils/Runtime/Physics/VelocityProvider.cs +++ b/Packages/tlp.udonutils/Runtime/Physics/VelocityProvider.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; -using UdonSharp; +using TLP.UdonUtils.Runtime.Recording; using UnityEngine; +using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Physics { @@ -8,15 +9,15 @@ namespace TLP.UdonUtils.Runtime.Physics /// calculates velocity and acceleration after everything that can affect locations and physics of objects which /// should be everything except audio /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(VelocityProvider), ExecutionOrder)] public abstract class VelocityProvider : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; // after everything that can affect locations and physics of objects which should be everything except audio [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.UiEnd + 1; + public new const int ExecutionOrder = TransformRecorder.ExecutionOrder + 1; public Transform RelativeTo; @@ -117,5 +118,20 @@ public abstract double GetLatestSnapShot( out Transform relativeTo, out float circleAngularVelocityDegrees ); + + #region Overrides + protected override bool SetupAndValidate() { + if (!base.SetupAndValidate()) { + return false; + } + + if (!Utilities.IsValid(RelativeTo)) { + Error($"{nameof(RelativeTo)} not set"); + return false; + } + + return true; + } + #endregion } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.asset b/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.asset index 7263512..fc20c01 100644 --- a/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.asset +++ b/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 8fe5cfd49aa35fe42ac43b4fcbf1b78c, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 9026317674757159852 serializationData: @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 1 + Data: 10 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: playerFarRangeMapping + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: playerFarRangeMapping + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: UnityEngine.AnimationCurve, UnityEngine.CoreModule + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -84,12 +84,597 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: _hadLogger + - Name: $v + Entry: 7 + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _hadLogger + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator + - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: playerFarRangeMapping + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: playerFarRangeMapping + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.AnimationCurve, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 1 - Name: Entry: 7 - Data: 5|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + Data: 44|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - Name: tooltip Entry: 1 Data: Defines the far voice range of all players depending on the number of diff --git a/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.cs b/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.cs index b2ecffc..a6082c1 100644 --- a/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.cs +++ b/Packages/tlp.udonutils/Runtime/Player/AutoPlayerRange.cs @@ -1,4 +1,5 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDKBase; @@ -7,9 +8,16 @@ namespace TLP.UdonUtils.Runtime.Player /// /// Updates the far voice range of all players every time a player leaves or joins the world. /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] - public class AutoPlayerRange : UdonSharpBehaviour + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(AutoPlayerRange), ExecutionOrder)] + public class AutoPlayerRange : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = CustomAudioFalloff.ExecutionOrder + 1; + /// /// default voice far range defined by VRChat /// https://docs.vrchat.com/docs/playewar-audio#set-voice-distance-far diff --git a/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.asset b/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.asset index 95dee37..4864a8a 100644 --- a/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.asset +++ b/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: a40c41c43d27bec49b8063b7324648ae, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 4677012757351136226 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.cs b/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.cs index 6dd0ac2..931e201 100644 --- a/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.cs +++ b/Packages/tlp.udonutils/Runtime/Player/CustomAudioFalloff.cs @@ -1,4 +1,6 @@ using System; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Events; using UdonSharp; using UnityEngine; using UnityEngine.Serialization; @@ -12,9 +14,16 @@ namespace TLP.UdonUtils.Runtime.Player /// Note: Obsolete/Redundant, use curve editor of AudioSource component directly. /// [Obsolete("Use curve editor of AudioSource directly")] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(CustomAudioFalloff), ExecutionOrder)] public class CustomAudioFalloff : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = AudioEvent.ExecutionOrder + 1; + #region Dependencies [FormerlySerializedAs("audioSource")] public AudioSource AudioSource; diff --git a/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.asset b/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.asset index 2beb7fb..ecadc05 100644 --- a/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.asset +++ b/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 074a51ead3044051aca7e3d57a66c8f5, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -4498166846169894726 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.cs b/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.cs index 1538f5c..14cc6ee 100644 --- a/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.cs +++ b/Packages/tlp.udonutils/Runtime/Player/DestroyIfDesktop.cs @@ -1,5 +1,6 @@ using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Common; +using TLP.UdonUtils.Runtime.Examples; using TLP.UdonUtils.Runtime.Logger; using UdonSharp; using UnityEngine; @@ -7,14 +8,15 @@ namespace TLP.UdonUtils.Runtime.Player { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [TlpDefaultExecutionOrder(typeof(DestroyIfDesktop), ExecutionOrder)] public class DestroyIfDesktop : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpLogger.ExecutionOrder + 1; + public new const int ExecutionOrder = WorldVersionEventListener.ExecutionOrder + 1; public override void Start() { base.Start(); diff --git a/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.asset b/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.asset index ed52725..d90bdbc 100644 --- a/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.asset +++ b/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 06d54c7a7a154303b0bba6619df8fe57, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 4005201727548711016 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.cs b/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.cs index efa1299..219b3b0 100644 --- a/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.cs +++ b/Packages/tlp.udonutils/Runtime/Player/DestroyIfVr.cs @@ -7,14 +7,15 @@ namespace TLP.UdonUtils.Runtime.Player { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [TlpDefaultExecutionOrder(typeof(DestroyIfVr), ExecutionOrder)] public class DestroyIfVr : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpLogger.ExecutionOrder + 1; + public new const int ExecutionOrder = DestroyIfDesktop.ExecutionOrder + 1; public override void Start() { base.Start(); diff --git a/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.asset b/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.asset index 5f98bea..7de66b7 100644 --- a/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.asset +++ b/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 5d473070c2f45414b8fe1f240c40572e, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -2301890996858461093 serializationData: @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 5 + Data: 14 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: player + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: player + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -84,6 +84,231 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -104,25 +329,265 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: useLocalPlayerByDefault + Data: _hadLogger - Name: $v Entry: 7 - Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: useLocalPlayerByDefault + Data: _hadLogger - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField Entry: 7 - Data: 6|System.RuntimeType, mscorlib + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 - 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: System.Boolean, mscorlib + Data: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator + - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 - Name: k__BackingField Entry: 9 - Data: 6 + Data: 3 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -137,7 +602,121 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 7|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: player + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: player + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: useLocalPlayerByDefault + - Name: $v + Entry: 7 + Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: useLocalPlayerByDefault + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 45|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -161,13 +740,13 @@ MonoBehaviour: Data: scale - Name: $v Entry: 7 - Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: scale - Name: k__BackingField Entry: 7 - Data: 9|System.RuntimeType, mscorlib + Data: 47|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Single, mscorlib @@ -176,7 +755,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 9 + Data: 47 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -191,7 +770,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 10|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 @@ -215,16 +794,16 @@ MonoBehaviour: Data: minSize - Name: $v Entry: 7 - Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: minSize - Name: k__BackingField Entry: 9 - Data: 9 + Data: 47 - Name: k__BackingField Entry: 9 - Data: 9 + Data: 47 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -239,7 +818,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -263,16 +842,16 @@ MonoBehaviour: Data: maxSize - Name: $v Entry: 7 - Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 51|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: maxSize - Name: k__BackingField Entry: 9 - Data: 9 + Data: 47 - Name: k__BackingField Entry: 9 - Data: 9 + Data: 47 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -287,7 +866,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 52|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.cs b/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.cs index 27e6cf6..e792fd2 100644 --- a/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.cs +++ b/Packages/tlp.udonutils/Runtime/Player/DistanceScalerUI.cs @@ -1,20 +1,28 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Player { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] - [DefaultExecutionOrder(50_000 + 10102)] - public class DistanceScalerUI : UdonSharpBehaviour + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(DistanceScalerUI), ExecutionOrder)] + public class DistanceScalerUI : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = LookAtPlayerUI.ExecutionOrder + 1; + public VRCPlayerApi player; public bool useLocalPlayerByDefault = true; public float scale = 0.1f; public float minSize = 0.00001f; public float maxSize = 1000f; - public void Start() { + public override void Start() { + base.Start(); if (useLocalPlayerByDefault) { player = Networking.LocalPlayer; } diff --git a/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.asset b/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.asset index a4eaecc..c4f02cc 100644 --- a/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.asset +++ b/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 9e7f888abcc6fe842a80cb1fa38f96a3, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 6970416967190135398 serializationData: @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 2 + Data: 11 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: weight + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: weight + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: System.Single, mscorlib + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -89,7 +89,592 @@ MonoBehaviour: Data: 2 - Name: Entry: 7 - Data: 5|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: _hadLogger + - Name: $v + Entry: 7 + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _hadLogger + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator + - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: weight + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: weight + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Single, mscorlib + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 44|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - Name: tooltip Entry: 1 Data: e.g. 0.5 makes it blend 50% between initial rotation and target rotation, @@ -99,7 +684,7 @@ MonoBehaviour: Data: - Name: Entry: 7 - Data: 6|UnityEngine.RangeAttribute, UnityEngine.CoreModule + Data: 45|UnityEngine.RangeAttribute, UnityEngine.CoreModule - Name: min Entry: 4 Data: 0 @@ -129,13 +714,13 @@ MonoBehaviour: Data: _initialRotation - Name: $v Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: _initialRotation - Name: k__BackingField Entry: 7 - Data: 8|System.RuntimeType, mscorlib + Data: 47|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Quaternion, UnityEngine.CoreModule @@ -144,7 +729,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 8 + Data: 47 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -159,7 +744,7 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 9|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 diff --git a/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.cs b/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.cs index bdcde1a..2ade1cd 100644 --- a/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.cs +++ b/Packages/tlp.udonutils/Runtime/Player/HorizontalLookAt.cs @@ -1,4 +1,5 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDKBase; @@ -8,9 +9,16 @@ namespace TLP.UdonUtils.Runtime.Player /// turns this gameobject around to always look at the local player, only rotates vertical rotation /// (pitch/roll are forced to 0) /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] - public class HorizontalLookAt : UdonSharpBehaviour + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(HorizontalLookAt), ExecutionOrder)] + public class HorizontalLookAt : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = LateBoneFollower.ExecutionOrder + 1; + [Tooltip( "e.g. 0.5 makes it blend 50% between initial rotation and target rotation, 1.0 makes it look directly at the player" )] @@ -19,7 +27,8 @@ public class HorizontalLookAt : UdonSharpBehaviour private Quaternion _initialRotation; - public void Start() { + public override void Start() { + base.Start(); _initialRotation = transform.rotation; } diff --git a/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.asset b/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.asset index a627a9c..f6c04c4 100644 --- a/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.asset +++ b/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 3961ac5c8dd7c4f4e88adf1467aa0832, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 8761011366653814882 serializationData: @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 1 + Data: 10 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: humanBodyBone + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: humanBodyBone + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: UnityEngine.HumanBodyBones, UnityEngine.AnimationModule + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -84,6 +84,591 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: _hadLogger + - Name: $v + Entry: 7 + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _hadLogger + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator + - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: humanBodyBone + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: humanBodyBone + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.HumanBodyBones, UnityEngine.AnimationModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.cs b/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.cs index 9632484..970e0b5 100644 --- a/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.cs +++ b/Packages/tlp.udonutils/Runtime/Player/LateBoneFollower.cs @@ -1,13 +1,22 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Player { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] - [DefaultExecutionOrder(50_000 + 100000)] - public class LateBoneFollower : UdonSharpBehaviour + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(LateBoneFollower), ExecutionOrder)] + public class LateBoneFollower : TlpBaseBehaviour { + + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TrackingDataFollower.ExecutionOrder + 1; + + public HumanBodyBones humanBodyBone; public override void PostLateUpdate() { diff --git a/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.asset b/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.asset index bea6624..27f487b 100644 --- a/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.asset +++ b/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: bbfae100b20f91f4493c4bb071848080, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -4610453216017582707 serializationData: @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 2 + Data: 11 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: player + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: player + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -84,6 +84,231 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -104,25 +329,379 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: useLocalPlayerByDefault + Data: _hadLogger - Name: $v Entry: 7 - Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: useLocalPlayerByDefault + Data: _hadLogger - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: false + - Name: _fieldAttributes Entry: 7 - Data: 6|System.RuntimeType, mscorlib + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: + Entry: 12 + Data: 0 + - 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: System.Boolean, mscorlib + Data: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator + - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 - Name: k__BackingField Entry: 9 - Data: 6 + Data: 3 + - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: player + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: player + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: useLocalPlayerByDefault + - Name: $v + Entry: 7 + Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: useLocalPlayerByDefault + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -137,7 +716,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 7|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 45|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.cs b/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.cs index db5967b..d54e981 100644 --- a/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.cs +++ b/Packages/tlp.udonutils/Runtime/Player/LookAtPlayerUI.cs @@ -1,17 +1,25 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Player { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] - [DefaultExecutionOrder(50_000 + 10101)] - public class LookAtPlayerUI : UdonSharpBehaviour + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(LookAtPlayerUI), ExecutionOrder)] + public class LookAtPlayerUI : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TrackingDataFollowerUI.ExecutionOrder + 1; + public VRCPlayerApi player; public bool useLocalPlayerByDefault = true; - public void Start() { + public override void Start() { + base.Start(); if (useLocalPlayerByDefault) { player = Networking.LocalPlayer; } diff --git a/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.asset b/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.asset index e04a671..d0e3848 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: 24 + Data: 23 - Name: Entry: 7 Data: @@ -1444,60 +1444,6 @@ MonoBehaviour: - Name: Entry: 8 Data: - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: RunTestOnPlayerJoin - - Name: $v - Entry: 7 - Data: 88|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: RunTestOnPlayerJoin - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 89|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 90|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/Player/PlayerBlackList.cs b/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.cs index c9bc126..9b47c22 100644 --- a/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.cs +++ b/Packages/tlp.udonutils/Runtime/Player/PlayerBlackList.cs @@ -11,14 +11,15 @@ namespace TLP.UdonUtils.Runtime.Player { - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(PlayerBlackList), ExecutionOrder)] public class PlayerBlackList : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultStart; + public new const int ExecutionOrder = SyncedPlayerSet.ExecutionOrder + 1; [SerializeField] internal SyncedEventStringArray BlackListedPlayers; diff --git a/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.asset b/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.asset index 8e3e8ea..ad46e0c 100644 --- a/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.asset +++ b/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: ad9c745c5e7940edb0b90ff74bb54a2a, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -1586964459902406943 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.cs b/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.cs index 06dfb42..5c8e8f9 100644 --- a/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.cs +++ b/Packages/tlp.udonutils/Runtime/Player/PlayerFollower.cs @@ -1,18 +1,20 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Events; using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Player { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(PlayerFollower), ExecutionOrder)] public class PlayerFollower : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultStart; + public new const int ExecutionOrder = TlpExecutionOrder.PlayerMotionStart + 500; public VRCPlayerApi Player; public bool UseLocalPlayerByDefault = true; diff --git a/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.asset b/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.asset index 0fdb412..df4fbaf 100644 --- a/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.asset +++ b/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: f148c904b88be4d46b4565fee09bf859, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -1173451542431129791 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.cs b/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.cs index 5396157..c501045 100644 --- a/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.cs +++ b/Packages/tlp.udonutils/Runtime/Player/PlayerFollowerUi.cs @@ -1,16 +1,19 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.DesignPatterns.MVC; +using TLP.UdonUtils.Runtime.Events; using UdonSharp; using UnityEngine; namespace TLP.UdonUtils.Runtime.Player { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(PlayerFollowerUi), ExecutionOrder)] public class PlayerFollowerUi : PlayerFollower { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.UiStart; + public new const int ExecutionOrder = UiEvent.ExecutionOrder + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Player/PlayerSet.cs b/Packages/tlp.udonutils/Runtime/Player/PlayerSet.cs index 3dcfcc7..a7a04ab 100644 --- a/Packages/tlp.udonutils/Runtime/Player/PlayerSet.cs +++ b/Packages/tlp.udonutils/Runtime/Player/PlayerSet.cs @@ -1,7 +1,9 @@ using System; +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Extensions; using TLP.UdonUtils.Runtime.Sync.SyncedEvents; using UdonSharp; +using UnityEngine; using VRC.SDK3.Data; using VRC.SDKBase; using VRC.Udon.Common; @@ -25,8 +27,16 @@ public enum PlayerListResult /// DO NOT MODIFY DIRECTLY! /// [UdonBehaviourSyncMode(BehaviourSyncMode.Any)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(PlayerSet), ExecutionOrder)] public class PlayerSet : SyncedEventIntArray { + + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventUrl.ExecutionOrder + 1; + #region Constants private const string UnknownPlayerName = "UNKNOWN PLAYER"; #endregion diff --git a/Packages/tlp.udonutils/Runtime/Player/SyncedPlayerSet.cs b/Packages/tlp.udonutils/Runtime/Player/SyncedPlayerSet.cs index 5ef5f8c..68bb179 100644 --- a/Packages/tlp.udonutils/Runtime/Player/SyncedPlayerSet.cs +++ b/Packages/tlp.udonutils/Runtime/Player/SyncedPlayerSet.cs @@ -1,4 +1,6 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.Player { @@ -6,8 +8,13 @@ namespace TLP.UdonUtils.Runtime.Player /// Version of the that uses no networking /// [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedPlayerSet), ExecutionOrder)] public class SyncedPlayerSet : PlayerSet { - // no changes + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = PlayerSet.ExecutionOrder + 1; // no changes } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.asset b/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.asset index 00a1f30..1483b5b 100644 --- a/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.asset +++ b/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 553a26fd01cad2d40a53f7ab542a0422, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 3705922373618776064 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.cs b/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.cs index 573c21c..a068e9c 100644 --- a/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.cs +++ b/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollower.cs @@ -1,4 +1,5 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Events; using UdonSharp; using UnityEngine; using UnityEngine.Serialization; @@ -6,14 +7,15 @@ namespace TLP.UdonUtils.Runtime.Player { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TrackingDataFollower), ExecutionOrder)] public class TrackingDataFollower : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultStart; + public new const int ExecutionOrder = WeaponsEvent.ExecutionOrder + 1; public VRCPlayerApi Player; diff --git a/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollowerUI.cs b/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollowerUI.cs index ccce375..a18dc93 100644 --- a/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollowerUI.cs +++ b/Packages/tlp.udonutils/Runtime/Player/TrackingDataFollowerUI.cs @@ -6,11 +6,12 @@ namespace TLP.UdonUtils.Runtime.Player { [UdonBehaviourSyncMode(BehaviourSyncMode.None)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TrackingDataFollowerUI), ExecutionOrder)] public class TrackingDataFollowerUI : TrackingDataFollower { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.UiStart; + public new const int ExecutionOrder = PlayerFollowerUi.ExecutionOrder + 1; } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Player/UdonInput.asset b/Packages/tlp.udonutils/Runtime/Player/UdonInput.asset index 2d83672..d1b6b77 100644 --- a/Packages/tlp.udonutils/Runtime/Player/UdonInput.asset +++ b/Packages/tlp.udonutils/Runtime/Player/UdonInput.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 847f625dc5bacd842bd2438ccf2a4f81, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 6720709735292409923 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Player/UdonInput.cs b/Packages/tlp.udonutils/Runtime/Player/UdonInput.cs index 8791eb1..2ee2684 100644 --- a/Packages/tlp.udonutils/Runtime/Player/UdonInput.cs +++ b/Packages/tlp.udonutils/Runtime/Player/UdonInput.cs @@ -1,14 +1,22 @@ -using UdonSharp; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Sync; +using UdonSharp; using UnityEngine; using VRC.SDKBase; using VRC.Udon.Common; namespace TLP.UdonUtils.Runtime.Player { - [DefaultExecutionOrder(50_000 + -500)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(UdonInput), ExecutionOrder)] public class UdonInput : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = OwnerOnly.ExecutionOrder + 1; + public static UdonInput Find() { var udonInputGameObject = GameObject.Find(nameof(UdonInput)); if (!Utilities.IsValid(udonInputGameObject)) { diff --git a/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.asset b/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.asset index a21a9e2..a2fcf65 100644 --- a/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.asset +++ b/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 23e72712be3a90045bc86f325155c49c, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -6173470000832586090 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.cs b/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.cs index fb55d20..05aa0c9 100644 --- a/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.cs +++ b/Packages/tlp.udonutils/Runtime/Pool/FactoryWithPool.cs @@ -1,12 +1,15 @@ using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Factories; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Pool { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(FactoryWithPool), ExecutionOrder)] public class FactoryWithPool : InstantiatingFactory { protected override int ExecutionOrderReadOnly => ExecutionOrder; diff --git a/Packages/tlp.udonutils/Runtime/Pool/Pool.asset b/Packages/tlp.udonutils/Runtime/Pool/Pool.asset index 5113a85..5e1f74a 100644 --- a/Packages/tlp.udonutils/Runtime/Pool/Pool.asset +++ b/Packages/tlp.udonutils/Runtime/Pool/Pool.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 7b3484a4db2e09d43b43501e5652acc3, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 9027030678822598698 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Pool/Pool.cs b/Packages/tlp.udonutils/Runtime/Pool/Pool.cs index 3e16860..a8b469d 100644 --- a/Packages/tlp.udonutils/Runtime/Pool/Pool.cs +++ b/Packages/tlp.udonutils/Runtime/Pool/Pool.cs @@ -1,6 +1,6 @@ using System; using JetBrains.Annotations; -using TLP.UdonUtils; +using TLP.UdonUtils.Runtime.Events; using UdonSharp; using UnityEngine; using UnityEngine.Serialization; @@ -9,14 +9,15 @@ namespace TLP.UdonUtils.Runtime.Pool { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(Pool), ExecutionOrder)] public class Pool : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpBaseBehaviour.ExecutionOrder + 1; + public new const int ExecutionOrder = ExampleEventListener.ExecutionOrder + 1; public bool AttachToParent = true; diff --git a/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.asset b/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.asset index dab01c1..28d55e9 100644 --- a/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.asset +++ b/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 1fd8aa69ae954c94aabb4799569190eb, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 5913606618494432336 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.cs b/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.cs index 2e3471e..4510e9d 100644 --- a/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.cs +++ b/Packages/tlp.udonutils/Runtime/Recording/TransformRecorder.cs @@ -6,14 +6,15 @@ namespace TLP.UdonUtils.Runtime.Recording { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TransformRecorder), ExecutionOrder)] public class TransformRecorder : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.Max; + public new const int ExecutionOrder = TlpExecutionOrder.RecordingStart + 1; [FormerlySerializedAs("directionThresholdAngle")] public float DirectionThresholdAngle = 10f; diff --git a/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.asset b/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.asset index e0738bd..beed5be 100644 --- a/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.asset +++ b/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 433aec9fb0adec1418b8770715ab16fe, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -63919542233545133 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.cs b/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.cs index 137094f..9279a8d 100644 --- a/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.cs +++ b/Packages/tlp.udonutils/Runtime/Recording/TransformRecordingPlayer.cs @@ -1,4 +1,7 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; +using TLP.UdonUtils.Runtime.Physics; +using TLP.UdonUtils.Runtime.Sync; using UdonSharp; using UnityEngine; using UnityEngine.Serialization; @@ -6,15 +9,15 @@ namespace TLP.UdonUtils.Runtime.Recording { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TransformRecordingPlayer), ExecutionOrder)] public class TransformRecordingPlayer : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.Min; - + public new const int ExecutionOrder = InertiaTensor.ExecutionOrder + 1; [FormerlySerializedAs("transformRecorder")] public TransformRecorder TransformRecorder; diff --git a/Packages/tlp.udonutils/Runtime/Rendering/ReflectionProbeController.asset b/Packages/tlp.udonutils/Runtime/Rendering/ReflectionProbeController.asset index 618bfeb..88fa31a 100644 --- a/Packages/tlp.udonutils/Runtime/Rendering/ReflectionProbeController.asset +++ b/Packages/tlp.udonutils/Runtime/Rendering/ReflectionProbeController.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: fe152f1571633cd499a864b691a7c791, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 4585017530569980649 serializationData: @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 11 + Data: 12 - Name: Entry: 7 Data: @@ -635,13 +635,13 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: reflectionProbe + Data: ReflectionProbe - Name: $v Entry: 7 Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: reflectionProbe + Data: ReflectionProbe - Name: k__BackingField Entry: 7 Data: 42|System.RuntimeType, mscorlib @@ -671,7 +671,13 @@ MonoBehaviour: Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 - Data: 0 + Data: 1 + - Name: + Entry: 7 + Data: 44|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: - Name: Entry: 13 Data: @@ -689,16 +695,16 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: updateInterval + Data: UpdateInterval - Name: $v Entry: 7 - Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: updateInterval + Data: UpdateInterval - Name: k__BackingField Entry: 7 - Data: 45|System.RuntimeType, mscorlib + Data: 46|System.RuntimeType, mscorlib - Name: Entry: 1 Data: System.Single, mscorlib @@ -707,7 +713,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 9 - Data: 45 + Data: 46 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -722,13 +728,19 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 - Data: 1 + Data: 2 - Name: Entry: 7 - Data: 47|UnityEngine.RangeAttribute, UnityEngine.CoreModule + Data: 48|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 49|UnityEngine.RangeAttribute, UnityEngine.CoreModule - Name: min Entry: 4 Data: 0 @@ -750,6 +762,54 @@ MonoBehaviour: - Name: Entry: 8 Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: _renderId + - Name: $v + Entry: 7 + Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _renderId + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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/Rendering/ReflectionProbeController.cs b/Packages/tlp.udonutils/Runtime/Rendering/ReflectionProbeController.cs index 39d5b80..a435505 100644 --- a/Packages/tlp.udonutils/Runtime/Rendering/ReflectionProbeController.cs +++ b/Packages/tlp.udonutils/Runtime/Rendering/ReflectionProbeController.cs @@ -1,19 +1,33 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; +using UnityEngine.Serialization; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Rendering { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(ReflectionProbeController), ExecutionOrder)] public class ReflectionProbeController : TlpBaseBehaviour { - public ReflectionProbe reflectionProbe; + protected override int ExecutionOrderReadOnly => ExecutionOrder; + [PublicAPI] + public new const int ExecutionOrder = TlpExecutionOrder.RecordingStart + 500; + + [FormerlySerializedAs("reflectionProbe")] + public ReflectionProbe ReflectionProbe; + + [FormerlySerializedAs("updateInterval")] [Range(0, 60)] - public float updateInterval = 10f; + public float UpdateInterval = 10f; + + private int _renderId = int.MinValue; public void OnEnable() { - if (!Assert(Utilities.IsValid(reflectionProbe), "reflectionProbe invalid", this)) { + if (!Utilities.IsValid(ReflectionProbe)) { + Error($"{nameof(ReflectionProbe)} not set"); return; } @@ -23,13 +37,15 @@ public void OnEnable() { public void UpdateReflections() { if (!(gameObject.activeInHierarchy && enabled - && Assert(Utilities.IsValid(reflectionProbe), "reflectionProbe invalid", this))) { + && Utilities.IsValid(ReflectionProbe))) { return; } - reflectionProbe.RenderProbe(); + if (_renderId == int.MinValue || ReflectionProbe.IsFinishedRendering(_renderId)) { + _renderId = ReflectionProbe.RenderProbe(); + } - SendCustomEventDelayedSeconds(nameof(UpdateReflections), updateInterval); + SendCustomEventDelayedSeconds(nameof(UpdateReflections), UpdateInterval); } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.asset b/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.asset index 6012138..657a131 100644 --- a/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.asset +++ b/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: d059cfc1960275945be609d0234fba07, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -3392681707186647654 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.cs b/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.cs index e11fd35..41583dc 100644 --- a/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.cs +++ b/Packages/tlp.udonutils/Runtime/Scenes/Examples/BlackListing/DemoBlackListToggle.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; -using TLP.UdonUtils; using TLP.UdonUtils.Runtime; +using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Extensions; using TLP.UdonUtils.Runtime.Player; using UdonSharp; @@ -8,14 +8,15 @@ using UnityEngine.UI; using VRC.SDKBase; +[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] -[UdonBehaviourSyncMode(BehaviourSyncMode.None)] +[TlpDefaultExecutionOrder(typeof(DemoBlackListToggle), ExecutionOrder)] public class DemoBlackListToggle : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.UiStart; + public new const int ExecutionOrder = ImageDownloader.ExecutionOrder + 1; public Button WhiteListButton; public Button BlackListButton; diff --git a/Packages/tlp.udonutils/Runtime/Scenes/Examples/StateMachine/StateMachineDemo.unity b/Packages/tlp.udonutils/Runtime/Scenes/Examples/StateMachine/StateMachineDemo.unity index c3cb405..edbe999 100644 --- a/Packages/tlp.udonutils/Runtime/Scenes/Examples/StateMachine/StateMachineDemo.unity +++ b/Packages/tlp.udonutils/Runtime/Scenes/Examples/StateMachine/StateMachineDemo.unity @@ -634,6 +634,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 255667513} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -722,6 +723,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 259713435} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -1216,17 +1218,17 @@ PrefabInstance: - target: {fileID: 2012949151903506351, guid: a2e29b4f6c24d5a49851f212381a8bf5, type: 3} propertyPath: Build - value: 72 + value: 215 objectReference: {fileID: 0} - target: {fileID: 2012949151903506351, guid: a2e29b4f6c24d5a49851f212381a8bf5, type: 3} propertyPath: Timestamp - value: 1717341365 + value: 1730316745 objectReference: {fileID: 0} - target: {fileID: 2012949151903506351, guid: a2e29b4f6c24d5a49851f212381a8bf5, type: 3} propertyPath: SyncedBuild - value: 72 + value: 215 objectReference: {fileID: 0} - target: {fileID: 2012949151903506351, guid: a2e29b4f6c24d5a49851f212381a8bf5, type: 3} @@ -1236,7 +1238,7 @@ PrefabInstance: - target: {fileID: 2012949151903506351, guid: a2e29b4f6c24d5a49851f212381a8bf5, type: 3} propertyPath: serializationData.SerializedFormat - value: 2 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2103673682335936013, guid: a2e29b4f6c24d5a49851f212381a8bf5, type: 3} @@ -1701,6 +1703,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1192279845} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -1776,6 +1779,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1225545173} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -1886,6 +1890,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1254482429} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -1961,6 +1966,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1331372888} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -2071,6 +2077,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1367368471} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -2222,6 +2229,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1563271562} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -2359,6 +2367,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1632418549} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -2547,6 +2556,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1817224147} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -2635,6 +2645,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1846372281} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -2840,6 +2851,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 1852422135} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -3012,6 +3024,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 2059664645} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} @@ -3088,6 +3101,7 @@ MonoBehaviour: SerializationNodes: [] _udonSharpBackingUdonBehaviour: {fileID: 2062283991} AutoRetrySendOnFailure: 1 + PauseSynchronization: 0 Severity: 5 EventInstigator: {fileID: 0} Pool: {fileID: 0} diff --git a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.asset b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.asset index acd499a..f188b40 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 1abbc992578818a41a5151a19860ce2d, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -8701573908910714562 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.cs b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.cs index adf23aa..1fae84c 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/ConstantFrameCount.cs @@ -1,4 +1,6 @@ -using UnityEngine; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; using UnityEngine.Serialization; namespace TLP.UdonUtils.Runtime.Sources.FrameCount @@ -7,8 +9,16 @@ namespace TLP.UdonUtils.Runtime.Sources.FrameCount /// Implementation of the /// that returns a constant value. /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(ConstantFrameCount), ExecutionOrder)] public class ConstantFrameCount : FrameCountSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = FrameCountSource.ExecutionOrder + 1; + /// /// Constant value returned by the method /// diff --git a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.asset b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.asset index 45747ae..2b0f2f9 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 0aaaf4357db58754bbc1db4a5dbbb7ed, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -842416243906137424 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.cs b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.cs index b74a4fc..d46898e 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/FrameCount/UpdateFrameCount.cs @@ -1,4 +1,6 @@ -using UnityEngine; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.Sources.FrameCount { @@ -6,8 +8,16 @@ namespace TLP.UdonUtils.Runtime.Sources.FrameCount /// Implementation of /// that returns the current frame count of Unity. /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(UpdateFrameCount), ExecutionOrder)] public class UpdateFrameCount : FrameCountSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = ConstantFrameCount.ExecutionOrder + 1; + /// public override int Frame() { return UnityEngine.Time.frameCount; diff --git a/Packages/tlp.udonutils/Runtime/Sources/FrameCountSource.cs b/Packages/tlp.udonutils/Runtime/Sources/FrameCountSource.cs index a9a00a0..373f1cc 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/FrameCountSource.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/FrameCountSource.cs @@ -1,13 +1,22 @@ -using UdonSharp; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; +using TLP.UdonUtils.Runtime.Sources.Time; +using UnityEngine; namespace TLP.UdonUtils.Runtime.Sources { /// /// Base class for frame counts that allows being independent of Unity. /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(FrameCountSource), ExecutionOrder)] public abstract class FrameCountSource : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = Comparer.ExecutionOrder + 100; + /// /// Implementation dependent number of frames. /// diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.asset b/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.asset index a56fe7a..31f8e52 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: fefc5ac0467213a4a829b3b3f13966da, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -2798809977734673021 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.cs b/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.cs index dd84428..22acecc 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/ConstantTime.cs @@ -1,4 +1,6 @@ -using UnityEngine; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; using UnityEngine.Serialization; namespace TLP.UdonUtils.Runtime.Sources.Time @@ -6,8 +8,15 @@ namespace TLP.UdonUtils.Runtime.Sources.Time /// /// that always returns the same value. /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(ConstantTime), ExecutionOrder)] public class ConstantTime : TimeSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TimeSource.ExecutionOrder + 1; #region Settings [Tooltip("Constant time returned by Time and TimeAsDouble")] [FormerlySerializedAs("Value")] diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.asset b/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.asset index 8d4ae46..e73aa50 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 94c91cd32a2a9ec4ab9999945e15c9e7, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 1891791712055016027 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.cs b/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.cs index 1a4bcd0..d8b5d97 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/Experimental/NtpTime.cs @@ -1,5 +1,7 @@ -using TLP.UdonUtils.Runtime.Sync.Experimental; -using TLP.UdonUtils.Runtime.Sources; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Sync.Experimental; +using UdonSharp; +using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Sources.Time.Experimental @@ -8,8 +10,16 @@ namespace TLP.UdonUtils.Runtime.Sources.Time.Experimental /// that synchronizes its time with the current instance master /// using the NTP algorithm /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(NtpTime), ExecutionOrder)] public class NtpTime : TimeSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = NtpServer.ExecutionOrder + 1; + public NtpClient NtpClient; public NtpServer NtpServer; diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.asset b/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.asset index f9a9058..b0de060 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: b94a7cd284052ce4d82e925c5978d8fa, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -8395479881725812136 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.cs b/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.cs index ebfa752..c4d1663 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/StopwatchTime.cs @@ -1,5 +1,8 @@ using System; using System.Diagnostics; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.Sources.Time @@ -7,8 +10,16 @@ namespace TLP.UdonUtils.Runtime.Sources.Time /// /// Uses a realtime based stopwatch that starts instantly as soon as this component is created. /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(StopwatchTime), ExecutionOrder)] public class StopwatchTime : TimeSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = ConstantTime.ExecutionOrder + 1; + [NonSerialized] public Stopwatch Stopwatch = new Stopwatch(); diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.asset b/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.asset index 400de7a..34ef3f6 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 51ce7b87045a2e041b76f9b4c4b26b9e, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 6524175758908717031 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.cs b/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.cs index f5217e3..71695e5 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/TimeSinceLevelLoad.cs @@ -1,11 +1,24 @@ -namespace TLP.UdonUtils.Runtime.Sources.Time +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; + +namespace TLP.UdonUtils.Runtime.Sources.Time { /// /// Implementation of /// that returns the Unity time since the level was loaded./> /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TimeSinceLevelLoad), ExecutionOrder)] public class TimeSinceLevelLoad : TimeSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = StopwatchTime.ExecutionOrder + 1; + + /// public override float Time() { return UnityEngine.Time.timeSinceLevelLoad; diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.asset b/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.asset index e24a149..e49009c 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: f5bdd47e74bf62047b9fe4035bb4660c, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 1419386277658642190 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.cs b/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.cs index 9573ece..9315e52 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/TlpNetworkTime.cs @@ -18,18 +18,16 @@ namespace TLP.UdonUtils.Runtime.Sources.Time /// /// In summary, it provides an averaged network time that is based on game time for smooth interpolations. /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [TlpDefaultExecutionOrder(typeof(TlpNetworkTime), ExecutionOrder)] public class TlpNetworkTime : TimeSource { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; - /// - /// Ensure that network time is determined as early as possible after the logger. - /// [PublicAPI] - public new const int ExecutionOrder = TlpLogger.ExecutionOrder + 1; + public new const int ExecutionOrder = VrcNetworkTime.ExecutionOrder + 1; #endregion #region Constants diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.asset b/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.asset index 3c9127e..8ebe278 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 3cc07c23597947d48be3c074d85b0fcf, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -8032402346041951651 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.cs b/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.cs index 0979fb6..2132d3c 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/UtcTimeSource.cs @@ -1,4 +1,7 @@ using System; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.Sources.Time { @@ -7,8 +10,15 @@ namespace TLP.UdonUtils.Runtime.Sources.Time /// the seconds since 1970/01/01 00:00.000000 /// Only offers a double based time value, float based is zero due to lack of accuracy! /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(UtcTimeSource), ExecutionOrder)] public class UtcTimeSource : TimeSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpNetworkTime.ExecutionOrder + 1; private DateTime _referenceTimeUtc; private bool _referenceTimeSet; diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.asset b/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.asset index 864ff44..8b6a586 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.asset +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: d34f58b20db605641b121eb5b30756bc, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -6029935647718017450 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.cs b/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.cs index 91a541d..a056dac 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/Time/VrcNetworkTime.cs @@ -1,4 +1,8 @@ -using VRC.SDKBase; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Sources.Time.Experimental; +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Sources.Time { @@ -6,8 +10,17 @@ namespace TLP.UdonUtils.Runtime.Sources.Time /// Implementation of /// using /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(VrcNetworkTime), ExecutionOrder)] public class VrcNetworkTime : TimeSource { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TimeSinceLevelLoad.ExecutionOrder + 1; + + protected override bool SetupAndValidate() { if (!base.SetupAndValidate()) { return false; diff --git a/Packages/tlp.udonutils/Runtime/Sources/TimeSource.cs b/Packages/tlp.udonutils/Runtime/Sources/TimeSource.cs index 919e996..5e20a1d 100644 --- a/Packages/tlp.udonutils/Runtime/Sources/TimeSource.cs +++ b/Packages/tlp.udonutils/Runtime/Sources/TimeSource.cs @@ -1,4 +1,7 @@ -using UdonSharp; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Sync; +using UdonSharp; +using UnityEngine; namespace TLP.UdonUtils.Runtime.Sources { @@ -6,9 +9,15 @@ namespace TLP.UdonUtils.Runtime.Sources /// Base class for time sources. /// Used to be more independent from Unity. /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TimeSource), ExecutionOrder)] public abstract class TimeSource : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TimeBacklog.ExecutionOrder + 1; + /// /// Current time of this source. /// diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.asset b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.asset index 7849542..59b38c6 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.asset +++ b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: e2cf1c7b3e815554d9591087a877bf6c, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 1399715621039139090 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.cs b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.cs index 90df305..4810607 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.cs +++ b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyState.cs @@ -1,10 +1,21 @@ -using TLP.UdonUtils.Runtime.Common; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; +using UdonSharp; +using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.StateMachine.Example { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(DummyState), ExecutionOrder)] public class DummyState : StateMachineState { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = StateMachineState.ExecutionOrder + 1; + public StateMachineState Next; public float Delay = 3f; diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.asset b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.asset index b9e2544..f948405 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.asset +++ b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: dad6e9b0b57901040bf12da26e34a847, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -4144862945675011755 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.cs b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.cs index a829d96..4c80e3d 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.cs +++ b/Packages/tlp.udonutils/Runtime/StateMachine/Example/DummyStateBehaviour.cs @@ -1,12 +1,21 @@ -using TLP.UdonUtils.Runtime.Common; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; +using UdonSharp; using UnityEngine; namespace TLP.UdonUtils.Runtime.StateMachine.Example { + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(DummyStateBehaviour), ExecutionOrder)] public class DummyStateBehaviour : StateMachineBehaviour { - public GameObject ThingToToggle; + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = StateMachineBehaviour.ExecutionOrder + 1; + public GameObject ThingToToggle; public override void OnStateEntered() { #region TLP_DEBUG diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.asset b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.asset index 3ad442b..a1a2c3a 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.asset +++ b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.asset @@ -44,7 +44,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 17 + Data: 20 - Name: Entry: 7 Data: @@ -947,13 +947,13 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: LocalStateIndex + Data: WorkingStateIndex - Name: $v Entry: 7 Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: LocalStateIndex + Data: WorkingStateIndex - Name: k__BackingField Entry: 9 Data: 13 @@ -995,19 +995,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: PendingDelayedStateTransition + Data: WorkingTransitionTime - Name: $v Entry: 7 Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: PendingDelayedStateTransition + Data: WorkingTransitionTime - Name: k__BackingField Entry: 9 - Data: 13 + Data: 52 - Name: k__BackingField Entry: 9 - Data: 13 + Data: 52 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -1043,16 +1043,112 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: k__BackingField + Data: LocalStateIndex - Name: $v Entry: 7 Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: k__BackingField + Data: LocalStateIndex - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes Entry: 7 - Data: 66|System.RuntimeType, mscorlib + Data: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: ScheduledTransitionTarget + - Name: $v + Entry: 7 + Data: 67|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: ScheduledTransitionTarget + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 68|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: DelayedTransitionTarget + - Name: $v + Entry: 7 + Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: DelayedTransitionTarget + - Name: k__BackingField + Entry: 7 + Data: 70|System.RuntimeType, mscorlib - Name: Entry: 1 Data: TLP.UdonUtils.Runtime.StateMachine.StateMachineState, TLP.UdonUtils.Runtime @@ -1076,7 +1172,55 @@ MonoBehaviour: Data: false - Name: _fieldAttributes Entry: 7 - Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 71|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: k__BackingField + - Name: $v + Entry: 7 + Data: 72|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 9 + Data: 70 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 73|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.cs b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.cs index d3e74c3..3b889c4 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.cs +++ b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachine.cs @@ -1,5 +1,7 @@ using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Extensions; +using TLP.UdonUtils.Runtime.Factories; using TLP.UdonUtils.Runtime.Sources.Time; using UdonSharp; using UnityEngine; @@ -13,15 +15,16 @@ namespace TLP.UdonUtils.Runtime.StateMachine /// Controls which and thus corresponding s are active. /// Which state is currently active is automatically synchronized across the network if set to manual sync. /// - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(StateMachine), ExecutionOrder)] public class StateMachine : TlpBaseBehaviour { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultStart; + public new const int ExecutionOrder = TlpFactory.ExecutionOrder + 100; #endregion #region Settings @@ -40,18 +43,23 @@ public class StateMachine : TlpBaseBehaviour public float EventSyncDelay = 0.5f; #endregion - #region Synced State [UdonSynced] internal int SyncedStateIndex = -1; [UdonSynced] internal float SyncedTransitionTime; + + #region Local Copy + internal int WorkingStateIndex = -1; + internal float WorkingTransitionTime; + #endregion #endregion #region State internal int LocalStateIndex = -1; - internal int PendingDelayedStateTransition = -1; + internal int ScheduledTransitionTarget = -1; + internal StateMachineState DelayedTransitionTarget; #endregion #region Lifecycle @@ -80,13 +88,12 @@ public virtual void OnDisable() { } #endregion - #region Public API /// /// Scheduled network time of the pending or last state transition. /// Can be used to determine exact timing between clients. /// - public float TransitionNetworkTime => SyncedTransitionTime; + public float TransitionNetworkTime => WorkingTransitionTime; public StateMachineState StateMachineState { get; internal set; } @@ -144,15 +151,15 @@ public bool OwnerSetNewState(int newStateIndex) { return false; } - if (newStateIndex != SyncedStateIndex) { + if (newStateIndex != WorkingStateIndex) { if (!MarkNetworkDirty()) { return false; } if (Utilities.IsValid(OptionalNetworkTime)) { - SyncedStateIndex = newStateIndex; - PendingDelayedStateTransition = newStateIndex; - SyncedTransitionTime = OptionalNetworkTime.Time() + EventSyncDelay; + WorkingStateIndex = newStateIndex; + ScheduledTransitionTarget = newStateIndex; + WorkingTransitionTime = OptionalNetworkTime.Time() + EventSyncDelay; SendCustomEventDelayedSeconds(nameof(Delayed_ActiveSyncedState), EventSyncDelay); return true; } @@ -165,7 +172,7 @@ public bool OwnerSetNewState(int newStateIndex) { } LocalStateIndex = newStateIndex; - SyncedStateIndex = newStateIndex; + WorkingStateIndex = newStateIndex; var newState = AllStates[newStateIndex]; StateMachineState = newState; newState.enabled = true; @@ -210,21 +217,51 @@ public bool LocalOnlySetNewState(int newStateIndex) { return true; } + + /// + /// Schedule a delayed transition to the target state + /// + /// There can only be a single delayed transition at once, + /// calling this multiple times may trigger an early transition using + /// the remaining delay of the first call + /// + /// + public bool TransitionToDelayed(StateMachineState targetState, float delaySeconds) { + if (!Utilities.IsValid(targetState)) { + Error($"{nameof(targetState)} invalid"); + return false; + } + + if (!Networking.IsOwner(gameObject)) { + Error($"{nameof(TransitionToDelayed)} caller must be owner"); + return false; + } + + DelayedTransitionTarget = targetState; + SendCustomEventDelayedSeconds(nameof(Delayed_TransitionToNext), delaySeconds); + return true; + } #endregion #region Network Events + public override void OnPreSerialization() { + base.OnPreSerialization(); + WriteNetworkState(); + } + public override void OnDeserialization(DeserializationResult deserializationResult) { base.OnDeserialization(deserializationResult); + ReadNetworkState(); + if (Utilities.IsValid(OptionalNetworkTime)) { if (TryScheduleDelayedTransition()) { return; } } - LocalOnlySetNewState(SyncedStateIndex); + LocalOnlySetNewState(WorkingStateIndex); } - public override void OnOwnershipTransferred(VRCPlayerApi player) { base.OnOwnershipTransferred(player); if (!player.IsLocalSafe()) { @@ -238,21 +275,6 @@ public override void OnOwnershipTransferred(VRCPlayerApi player) { #endregion #region Internal - public void Delayed_ActiveSyncedState() { - #region TLP_DEBUG -#if TLP_DEBUG - DebugLog(nameof(Delayed_ActiveSyncedState)); -#endif - #endregion - - if (PendingDelayedStateTransition != SyncedStateIndex) { - Warn("Another state is already pending, discarding delayed transition"); - return; - } - - LocalOnlySetNewState(SyncedStateIndex); - } - internal bool Initialize() { #if TLP_DEBUG DebugLog(nameof(Initialize)); @@ -322,15 +344,73 @@ internal bool InitializeAllStates() { } private bool TryScheduleDelayedTransition() { - float delay = SyncedTransitionTime - OptionalNetworkTime.Time(); + float delay = WorkingTransitionTime - OptionalNetworkTime.Time(); if (delay <= 0f) { return false; } - PendingDelayedStateTransition = SyncedStateIndex; + ScheduledTransitionTarget = WorkingStateIndex; SendCustomEventDelayedSeconds(nameof(Delayed_ActiveSyncedState), delay); return true; } + + private void ReadNetworkState() { + WorkingStateIndex = SyncedStateIndex; + WorkingTransitionTime = SyncedTransitionTime; + } + + private void WriteNetworkState() { + SyncedStateIndex = WorkingStateIndex; + SyncedTransitionTime = WorkingTransitionTime; + } + + #region Delayed + /// + /// DO NOT CALL DIRECTLY! + /// Performs the scheduled transition to + /// + public void Delayed_TransitionToNext() { + #region TLP_DEBUG +#if TLP_DEBUG + DebugLog(nameof(Delayed_TransitionToNext)); +#endif + #endregion + + if (!Utilities.IsValid(DelayedTransitionTarget)) { + Warn( + $"{nameof(Delayed_TransitionToNext)} had no target. {nameof(TransitionToDelayed)} was most likely called multiple times."); + return; + } + + if (!Networking.IsOwner(gameObject)) { + Warn( + $"Caller of {nameof(Delayed_TransitionToNext)} has no longer ownership, aborting scheduled transition to {DelayedTransitionTarget.GetScriptPathInScene()}"); + return; + } + + OwnerSetNewState(DelayedTransitionTarget.StateMachineIndex); + DelayedTransitionTarget = null; + } + + /// + /// DO NOT CALL DIRECTLY! + /// Performs the scheduled transition to + /// + public void Delayed_ActiveSyncedState() { + #region TLP_DEBUG +#if TLP_DEBUG + DebugLog(nameof(Delayed_ActiveSyncedState)); +#endif + #endregion + + if (ScheduledTransitionTarget != WorkingStateIndex) { + Warn("Another state is already pending, discarding delayed transition"); + return; + } + + LocalOnlySetNewState(WorkingStateIndex); + } + #endregion #endregion #region Overrides diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineBehaviour.cs b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineBehaviour.cs index 9fc2665..106f378 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineBehaviour.cs +++ b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineBehaviour.cs @@ -10,15 +10,16 @@ namespace TLP.UdonUtils.Runtime.StateMachine /// Only active while the is set and active. /// /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [TlpDefaultExecutionOrder(typeof(StateMachineBehaviour), ExecutionOrder)] public abstract class StateMachineBehaviour : TlpBaseBehaviour { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = StateMachineState.ExecutionOrder + 1; + public new const int ExecutionOrder = StateMachineState.ExecutionOrder + 100; #endregion #region State diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineState.cs b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineState.cs index 9233120..264b6fb 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineState.cs +++ b/Packages/tlp.udonutils/Runtime/StateMachine/StateMachineState.cs @@ -21,15 +21,16 @@ namespace TLP.UdonUtils.Runtime.StateMachine /// Should be extended to implement conditions for transitioning to other states. /// Alternatively transition logic can be implemented in dedicated s. /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [TlpDefaultExecutionOrder(typeof(StateMachineState), ExecutionOrder)] public class StateMachineState : TlpBaseBehaviour { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = StateMachine.ExecutionOrder + 1; + public new const int ExecutionOrder = StateMachine.ExecutionOrder + 100; #endregion #region State diff --git a/Packages/tlp.udonutils/Runtime/StateMachine/StatemachineState.asset b/Packages/tlp.udonutils/Runtime/StateMachine/StatemachineState.asset index c286e77..6075b42 100644 --- a/Packages/tlp.udonutils/Runtime/StateMachine/StatemachineState.asset +++ b/Packages/tlp.udonutils/Runtime/StateMachine/StatemachineState.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: e258ba4bb220bd4468c3a4432d9ac8ab, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -1076095392846975650 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpClient.cs b/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpClient.cs index 1a7e577..1b4494d 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpClient.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpClient.cs @@ -2,6 +2,7 @@ using TLP.UdonUtils.Runtime.Adapters.Cyan; using TLP.UdonUtils.Runtime.Extensions; using TLP.UdonUtils.Runtime.Sources; +using TLP.UdonUtils.Runtime.Sources.Time; using TLP.UdonUtils.Runtime.Sources.Time.Experimental; using UdonSharp; using UnityEngine; @@ -25,13 +26,14 @@ namespace TLP.UdonUtils.Runtime.Sync.Experimental /// [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(NtpClient), ExecutionOrder)] public class NtpClient : CyanPooledObject { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = NtpTime.ExecutionOrder - 2; + public new const int ExecutionOrder = UtcTimeSource.ExecutionOrder + 1; #endregion #region Dependencies diff --git a/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpServer.cs b/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpServer.cs index cdb6487..35b6454 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpServer.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/Experimental/NtpServer.cs @@ -1,5 +1,4 @@ using System; -using BestHTTP.SecureProtocol.Org.BouncyCastle.Ocsp; using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Adapters.Cyan; using TLP.UdonUtils.Runtime.Common; @@ -24,13 +23,14 @@ namespace TLP.UdonUtils.Runtime.Sync.Experimental /// [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(NtpServer), ExecutionOrder)] public class NtpServer : CyanPoolEventListener { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = NtpTime.ExecutionOrder - 1; + public new const int ExecutionOrder = NtpClient.ExecutionOrder + 1; #endregion #region Dependencies diff --git a/Packages/tlp.udonutils/Runtime/Sync/ManualSync.cs b/Packages/tlp.udonutils/Runtime/Sync/ManualSync.cs deleted file mode 100644 index 8d3af51..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/ManualSync.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using UdonSharp; -using UnityEngine; -using VRC.SDKBase; -using VRC.Udon.Common; - -namespace TLP.UdonUtils.Runtime.Sync -{ - [Obsolete("Use NetworkTransform intead")] - [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] - public class ManualSync : UdonSharpBehaviour - { - public float updateInterval = 0.25f; - public float lastNetworkUpdate; - - [UdonSynced] - public Vector3 position; - - [UdonSynced] - public Vector3 rotation; - - public Rigidbody ownRigidbody; - - private void Start() { - lastNetworkUpdate = Time.unscaledTime; - if (Networking.IsMaster) { - TakeOwnership(); - } - } - - public void LateUpdate() { - if (!Networking.IsOwner(Networking.LocalPlayer, gameObject)) { - return; - } - - float unscaledTime = Time.unscaledTime; - if (unscaledTime - lastNetworkUpdate > updateInterval) { - lastNetworkUpdate = unscaledTime; - var transform1 = transform; - position = transform1.position; - rotation = transform1.rotation.eulerAngles; - RequestSerialization(); - } - } - - public override void OnPickup() { - TakeOwnership(); - } - - public override void Interact() { - TakeOwnership(); - var vrcPlayerApi = Networking.LocalPlayer; - if (Utilities.IsValid(vrcPlayerApi)) { - vrcPlayerApi.UseAttachedStation(); - } - } - - private void TakeOwnership() { - var localPlayer = Networking.LocalPlayer; - if (Utilities.IsValid(localPlayer)) { - Networking.SetOwner(localPlayer, gameObject); - } - } - - public override void OnOwnershipTransferred(VRCPlayerApi player) { - if (!Utilities.IsValid(player)) { - Debug.LogWarning( - GetLogPrefix() + $"ManualSync.OnOwnershipTransferred: Ownership transferred " + - $"to invalid player" - ); - return; - } - - Debug.Log( - GetLogPrefix() + $"ManualSync.OnOwnershipTransferred: Ownership transferred to " + - $"{player.displayName} ({player.playerId})" - ); - } - - public override void OnPreSerialization() { - Debug.Log(GetLogPrefix() + $"ManualSync.OnPreSerialization: "); - } - - public override void OnDeserialization(DeserializationResult deserializationResult) { - Debug.Log(GetLogPrefix() + $"ManualSync.OnDeserialization: "); - - if (Networking.IsOwner(Networking.LocalPlayer, gameObject)) { - return; - } - - if (Utilities.IsValid(ownRigidbody)) { - ownRigidbody.angularVelocity = Vector3.zero; - ownRigidbody.velocity = Vector3.zero; - } - - transform.SetPositionAndRotation(position, Quaternion.Euler(rotation)); - } - - public override void OnPostSerialization(SerializationResult result) { - if (!result.success) { - Debug.LogWarning( - GetLogPrefix() + $"ManualSync.OnPostSerialization: Serialization failed, trying again", - this - ); - RequestSerialization(); - return; - } - - Debug.Log(GetLogPrefix() + $"ManualSync.OnPostSerialization: Serialized {result.byteCount} bytes"); - } - - public override bool OnOwnershipRequest(VRCPlayerApi requestingPlayer, VRCPlayerApi requestedOwner) { - bool requester = false; - bool requested = false; - if (!Utilities.IsValid(requestingPlayer)) { - Debug.LogWarning(GetLogPrefix() + $"ManualSync.OnOwnershipRequest: requesting player is invalid"); - } else { - Debug.Log( - GetLogPrefix() + $"ManualSync.OnOwnershipRequest: " + - $"{requestingPlayer.displayName} ({requestingPlayer.playerId}) requests ownership change" - ); - requester = true; - } - - if (!Utilities.IsValid(requestedOwner)) { - Debug.LogWarning(GetLogPrefix() + $"ManualSync.OnOwnershipRequest: requested owner is invalid"); - } else { - Debug.Log( - GetLogPrefix() + $"ManualSync.OnOwnershipRequest: " + - $"{requestedOwner.displayName} ({requestedOwner.playerId}) is requested to be owner" - ); - requested = true; - } - - Debug.Log( - GetLogPrefix() + $"ManualSync.OnOwnershipRequest: " + - $"Granting ownership transfer: {requester && requested}" - ); - return requester && requested; - } - - private string GetLogPrefix() { - var player = Networking.LocalPlayer; - if (Utilities.IsValid(player)) { - return $"[{player.displayName} ({player.playerId})] "; - } - - return "[Unknown local player] "; - } - } -} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/ManualSync.cs.meta b/Packages/tlp.udonutils/Runtime/Sync/ManualSync.cs.meta deleted file mode 100644 index 8f9467f..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/ManualSync.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 81f6fe32503a3084fbe29d74d0e57bbf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.asset b/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.asset index 5e5a88a..fc28eee 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.asset +++ b/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.asset @@ -44,25 +44,25 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 2 + Data: 11 - Name: Entry: 7 Data: - Name: $k Entry: 1 - Data: gameObjects + Data: AutoRetrySendOnFailure - Name: $v Entry: 7 Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: gameObjects + Data: AutoRetrySendOnFailure - Name: k__BackingField Entry: 7 Data: 3|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: UnityEngine.GameObject[], UnityEngine.CoreModule + Data: System.Boolean, mscorlib - Name: Entry: 8 Data: @@ -84,6 +84,591 @@ MonoBehaviour: - Name: _fieldAttributes Entry: 7 Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Networking + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: If true and a serialization request fails it will automatically try to + send again in the next frame until it succeeds. Only applies to owned objects + and manual sync. + - 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: PauseSynchronization + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PauseSynchronization + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Has no effect unless implemented by this particular script. See SyncPaused + property for details. + - 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: Severity + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Severity + - Name: k__BackingField + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: TLP/Logging + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: 'What kind of logs of this behavior shall be produced. Selected severity + includes all more severe levels. Example: selecting ''Warning'' also allows + ''Error'' and ''Assertion'' messages to appear. + + Note: + + ''Debug'' + messages are filtered out by default, even when selected. Add the compiler + definition ''TLP_DEBUG'' in the Unity player settings to enable them. This + should only ever be used for debugging (performance suffers)!' + - 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: PendingSerializations + - Name: $v + Entry: 7 + Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PendingSerializations + - Name: k__BackingField + Entry: 9 + Data: 13 + - Name: k__BackingField + Entry: 9 + Data: 13 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: _hadLogger + - Name: $v + Entry: 7 + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: _hadLogger + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: k__BackingField + - Name: $v + Entry: 7 + Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: k__BackingField + - Name: k__BackingField + Entry: 7 + Data: 23|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 7 + Data: 24|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - 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: false + - Name: _fieldAttributes + Entry: 7 + Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - 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: EventInstigator + - Name: $v + Entry: 7 + Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: EventInstigator + - Name: k__BackingField + Entry: 7 + Data: 27|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool + - Name: $v + Entry: 7 + Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: Pool + - Name: k__BackingField + Entry: 9 + Data: 27 + - Name: k__BackingField + Entry: 9 + Data: 24 + - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse + - Name: $v + Entry: 7 + Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: PoolableInUse + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 9 + Data: 3 + - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 40|UnityEngine.HideInInspector, 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: gameObjects + - Name: $v + Entry: 7 + Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: gameObjects + - Name: k__BackingField + Entry: 7 + Data: 42|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.GameObject[], UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 42 + - 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: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 @@ -107,13 +692,13 @@ MonoBehaviour: Data: UdonSharpBehaviours - Name: $v Entry: 7 - Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 Data: UdonSharpBehaviours - Name: k__BackingField Entry: 7 - Data: 6|System.RuntimeType, mscorlib + Data: 45|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UdonSharp.UdonSharpBehaviour[], UdonSharp.Runtime @@ -122,7 +707,7 @@ MonoBehaviour: Data: - Name: k__BackingField Entry: 7 - Data: 7|System.RuntimeType, mscorlib + Data: 46|System.RuntimeType, mscorlib - Name: Entry: 1 Data: UnityEngine.Component[], UnityEngine.CoreModule @@ -143,7 +728,7 @@ MonoBehaviour: Data: true - Name: _fieldAttributes Entry: 7 - Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + Data: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - Name: Entry: 12 Data: 0 diff --git a/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.cs b/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.cs index 8ca79dc..0c1b448 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/OwnerOnly.cs @@ -1,12 +1,22 @@ -using UdonSharp; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Events; +using UdonSharp; using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Sync { [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] - public class OwnerOnly : UdonSharpBehaviour + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(OwnerOnly), ExecutionOrder)] + public class OwnerOnly : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = DirectInputEvent.ExecutionOrder + 1; + + public GameObject[] gameObjects; public UdonSharpBehaviour[] UdonSharpBehaviours; diff --git a/Packages/tlp.udonutils/Runtime/Sync/RoundRobinSynchronizer.cs b/Packages/tlp.udonutils/Runtime/Sync/RoundRobinSynchronizer.cs index dbaa26a..663a29d 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/RoundRobinSynchronizer.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/RoundRobinSynchronizer.cs @@ -1,6 +1,7 @@ using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Events; using TLP.UdonUtils.Runtime.Extensions; +using TLP.UdonUtils.Runtime.Sync.SyncedEvents; using UdonSharp; using UnityEngine; using VRC.SDKBase; @@ -12,13 +13,14 @@ namespace TLP.UdonUtils.Runtime.Sync /// Gives every player an equal chance to send something, ownership is controlled by the current master /// [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] - [DefaultExecutionOrder(ExecutionOrder)] // TODO move me to the class declaration! + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(RoundRobinSynchronizer), ExecutionOrder)] public class RoundRobinSynchronizer : TlpBaseBehaviour { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.UiEnd + 1; + public new const int ExecutionOrder = SyncedEvent.ExecutionOrder + 100; private VRCPlayerApi[] _players; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEvent.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEvent.cs index 727650f..3e22e95 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEvent.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEvent.cs @@ -8,13 +8,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEvent), ExecutionOrder)] public class SyncedEvent : UdonEvent { #region Executionorder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.DefaultStart + 1; + public new const int ExecutionOrder = UdonEvent.ExecutionOrder + 1; [Tooltip( "If enabled synchronisation is requested instantly instead of on the next frame, " + diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventBool.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventBool.cs index c4f66bd..32ce876 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventBool.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventBool.cs @@ -8,8 +8,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventBool), ExecutionOrder)] public class SyncedEventBool : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEvent.ExecutionOrder + 1; + [UdonSynced] internal bool SyncedValue; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventDouble.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventDouble.cs index 6a30165..4e318cf 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventDouble.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventDouble.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using UdonSharp; using UnityEngine; using VRC.Udon.Common; @@ -7,8 +8,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventDouble), ExecutionOrder)] public class SyncedEventDouble : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventBool.ExecutionOrder + 1; + [UdonSynced] internal double SyncedValue; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventFloat.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventFloat.cs index 75bcfde..972e16a 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventFloat.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventFloat.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using UdonSharp; using UnityEngine; using VRC.Udon.Common; @@ -7,8 +8,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventFloat), ExecutionOrder)] public class SyncedEventFloat : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventDouble.ExecutionOrder + 1; + [UdonSynced] internal float SyncedValue; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventInt.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventInt.cs index 91b955a..0ea22a7 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventInt.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventInt.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using UdonSharp; using UnityEngine; using VRC.Udon.Common; @@ -7,8 +8,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventInt), ExecutionOrder)] public class SyncedEventInt : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventFloat.ExecutionOrder + 1; + [UdonSynced] internal int SyncedValue; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventIntArray.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventIntArray.cs index 5d0be7e..343fbd2 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventIntArray.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventIntArray.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Extensions; using UdonSharp; using UnityEngine; @@ -8,8 +9,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventIntArray), ExecutionOrder)] public class SyncedEventIntArray : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventInt.ExecutionOrder + 1; + [UdonSynced] internal int[] SyncedValues = new int[0]; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventString.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventString.cs index 8da59fe..a146d5f 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventString.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventString.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using UdonSharp; using UnityEngine; using VRC.Udon.Common; @@ -7,8 +8,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventString), ExecutionOrder)] public class SyncedEventString : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventIntArray.ExecutionOrder + 1; + [UdonSynced] internal string SyncedValue; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventStringArray.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventStringArray.cs index 553fe66..1cbadba 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventStringArray.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventStringArray.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Extensions; using UdonSharp; using UnityEngine; @@ -8,8 +9,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventStringArray), ExecutionOrder)] public class SyncedEventStringArray : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventString.ExecutionOrder + 1; + [UdonSynced] internal string[] SyncedValues = new string[0]; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventUrl.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventUrl.cs index deafaa2..6be51fd 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventUrl.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/SyncedEvents/SyncedEventUrl.cs @@ -1,4 +1,5 @@ using System; +using JetBrains.Annotations; using UdonSharp; using UnityEngine; using VRC.SDKBase; @@ -8,8 +9,14 @@ namespace TLP.UdonUtils.Runtime.Sync.SyncedEvents { [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(SyncedEventUrl), ExecutionOrder)] public class SyncedEventUrl : SyncedEvent { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = SyncedEventStringArray.ExecutionOrder + 1; + [UdonSynced] internal VRCUrl SyncedValue; diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables.meta deleted file mode 100644 index 992b6e5..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f226983a6b0b49008d22ce7c9c8dfc23 -timeCreated: 1680637073 \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.asset b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.asset deleted file mode 100644 index 12f7caf..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.asset +++ /dev/null @@ -1,233 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} - m_Name: SyncedBool - m_EditorClassIdentifier: - serializedUdonProgramAsset: {fileID: 11400000, guid: 38f48e7a7a3fb4f468c74c203581f0df, - type: 2} - udonAssembly: - assemblyError: - sourceCsScript: {fileID: 11500000, guid: b2959ccf98efa4a4a9d4240889817c71, type: 3} - scriptVersion: 2 - compiledVersion: 2 - behaviourSyncMode: 4 - hasInteractEvent: 0 - scriptID: 7695289904022170783 - serializationData: - SerializedFormat: 2 - SerializedBytes: - ReferencedUnityObjects: [] - SerializedBytesString: - Prefab: {fileID: 0} - PrefabModificationsReferencedUnityObjects: [] - PrefabModifications: [] - SerializationNodes: - - Name: fieldDefinitions - Entry: 7 - Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, - UdonSharp.Editor]], mscorlib - - Name: comparer - Entry: 7 - Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, - mscorlib]], mscorlib - - Name: - Entry: 8 - Data: - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: SyncedValue - - Name: $v - Entry: 7 - Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: SyncedValue - - Name: k__BackingField - Entry: 7 - Data: 3|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Boolean, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 3 - Data: 1 - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: false - - Name: _fieldAttributes - Entry: 7 - Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 5|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 6|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - - 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: targetFieldNames - - Name: $v - Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetFieldNames - - Name: k__BackingField - Entry: 7 - Data: 8|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.String[], mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 8 - - 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: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: listeners - - Name: $v - Entry: 7 - Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: listeners - - Name: k__BackingField - Entry: 7 - Data: 11|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UdonSharp.UdonSharpBehaviour[], UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 12|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Component[], UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - 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: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.asset.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.asset.meta deleted file mode 100644 index 7b54418..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 933a01831daebc5489b645258b030b1e -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.cs deleted file mode 100644 index 6eeac89..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using UdonSharp; -using UnityEngine; -using VRC.SDKBase; -using VRC.Udon.Common; - -namespace TLP.UdonUtils.Runtime.Sync.SyncedVariables -{ - [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] - [Obsolete("Use sync Events instead")] - public class SyncedBool : UdonSharpBehaviour - { - [UdonSynced] - [FieldChangeCallback(nameof(BoolValueProperty))] - internal bool SyncedValue; - - public string[] targetFieldNames; - public UdonSharpBehaviour[] listeners; - - public bool BoolValueProperty - { - set - { - bool valueUnchanged = SyncedValue == value; - if (valueUnchanged) { - return; - } - - SyncedValue = value; - - if (Networking.IsOwner(gameObject)) { - RequestSerialization(); - } - - NotifyListeners(); - } - get => SyncedValue; - } - - public override void OnPostSerialization(SerializationResult result) { - if (result.success) { - return; - } - - SendCustomEventDelayedSeconds(nameof(RequestSerialization), 1f); - } - - - internal bool ListenerSetupValid() { - bool listenersNull = listeners == null; - if (listenersNull) { - return false; - } - - bool targetVariablesNull = targetFieldNames == null; - if (targetVariablesNull) { - return false; - } - - return listeners.Length == targetFieldNames.Length; - } - - internal void NotifyListeners() { - if (!ListenerSetupValid()) { - Debug.LogError("Invalid listener setup"); - return; - } - - for (int i = 0; i < listeners.Length; i++) { - if (Utilities.IsValid(listeners[i])) { - listeners[i].SetProgramVariable(targetFieldNames[i], SyncedValue); - } - } - } - } -} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.cs.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.cs.meta deleted file mode 100644 index d2d5181..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedBool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b2959ccf98efa4a4a9d4240889817c71 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.asset b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.asset deleted file mode 100644 index 1b3fdf2..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.asset +++ /dev/null @@ -1,914 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} - m_Name: SyncedInteger - m_EditorClassIdentifier: - serializedUdonProgramAsset: {fileID: 11400000, guid: 5a187664100e5d946b5606b0a619933a, - type: 2} - udonAssembly: - assemblyError: - sourceCsScript: {fileID: 11500000, guid: 64b2c7b826b74c6ead3a2d763843fa6a, type: 3} - scriptVersion: 2 - compiledVersion: 2 - behaviourSyncMode: 4 - hasInteractEvent: 0 - scriptID: 4961771632248155111 - serializationData: - SerializedFormat: 2 - SerializedBytes: - ReferencedUnityObjects: [] - SerializedBytesString: - Prefab: {fileID: 0} - PrefabModificationsReferencedUnityObjects: [] - PrefabModifications: [] - SerializationNodes: - - Name: fieldDefinitions - Entry: 7 - Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, - UdonSharp.Editor]], mscorlib - - Name: comparer - Entry: 7 - Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, - mscorlib]], mscorlib - - Name: - Entry: 8 - Data: - - Name: - Entry: 12 - Data: 14 - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: $v - Entry: 7 - Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: k__BackingField - Entry: 7 - Data: 3|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Boolean, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Networking - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: If true and a serialization request fails it will automatically try to - send again in the next frame until it succeeds. Only applies to owned objects - and manual sync. - - 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: PauseSynchronization - - Name: $v - Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PauseSynchronization - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Has no effect unless implemented by this particular script. See SyncPaused - property for details. - - 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: Severity - - Name: $v - Entry: 7 - Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Severity - - Name: k__BackingField - Entry: 7 - Data: 12|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 13|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Int32, mscorlib - - Name: - Entry: 8 - Data: - - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Logging - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: 'What kind of logs of this behavior shall be produced. Selected severity - includes all more severe levels. Example: selecting ''Warning'' also allows - ''Error'' and ''Assertion'' messages to appear. - - Note: - - ''Debug'' - messages are filtered out by default, even when selected. Add the compiler - definition ''TLP_DEBUG'' in the Unity player settings to enable them. This - should only ever be used for debugging (performance suffers)!' - - 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: PendingSerializations - - Name: $v - Entry: 7 - Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PendingSerializations - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 9 - Data: 13 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: _hadLogger - - Name: $v - Entry: 7 - Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: _hadLogger - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: k__BackingField - - Name: $v - Entry: 7 - Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: k__BackingField - - Name: k__BackingField - Entry: 7 - Data: 23|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 24|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: VRC.Udon.UdonBehaviour, VRC.Udon - - Name: - Entry: 8 - Data: - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: EventInstigator - - Name: $v - Entry: 7 - Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: EventInstigator - - Name: k__BackingField - Entry: 7 - Data: 27|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool - - Name: $v - Entry: 7 - Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Pool - - Name: k__BackingField - Entry: 9 - Data: 27 - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse - - Name: $v - Entry: 7 - Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PoolableInUse - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 40|UnityEngine.HideInInspector, 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: autoResetOnSuccess - - Name: $v - Entry: 7 - Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: autoResetOnSuccess - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: SyncedValue - - Name: $v - Entry: 7 - Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: SyncedValue - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 3 - Data: 1 - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: false - - Name: _fieldAttributes - Entry: 7 - Data: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 45|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 46|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - - 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: targetFieldNames - - Name: $v - Entry: 7 - Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetFieldNames - - Name: k__BackingField - Entry: 7 - Data: 48|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.String[], 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: 0 - - 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: listeners - - Name: $v - Entry: 7 - Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: listeners - - Name: k__BackingField - Entry: 7 - Data: 51|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UdonSharp.UdonSharpBehaviour[], UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 52|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Component[], UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - 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: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: onChanged - - Name: $v - Entry: 7 - Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: onChanged - - Name: k__BackingField - Entry: 7 - Data: 55|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Events.UdonEvent, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 56|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.asset.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.asset.meta deleted file mode 100644 index 34f6aa8..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c323dfc89548c2e4cb25c6369b832dff -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.cs deleted file mode 100644 index 0ddf69e..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using TLP.UdonUtils.Runtime.Events; -using UdonSharp; -using UnityEngine; -using VRC.SDKBase; -using VRC.Udon.Common; - -namespace TLP.UdonUtils.Runtime.Sync.SyncedVariables -{ - /// - /// Component which is used to synchronize a value on demand independently from high continuous synced udon - /// behaviours to reduce bandwidth. - /// - [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] - [Obsolete("Use sync Events instead", false)] - public class SyncedInteger : TlpBaseBehaviour - { - /// - /// resets the value back to 0 after it was successfully sent - /// - public bool autoResetOnSuccess; - - [UdonSynced] - [FieldChangeCallback(nameof(IntValueProperty))] - internal int SyncedValue; - - public string[] targetFieldNames; - public UdonSharpBehaviour[] listeners; - public UdonEvent onChanged; - - public int IntValueProperty - { - set - { - #region TLP_DEBUG -#if TLP_DEBUG - DebugLog($"Set IntValueProperty: {value}"); -#endif - #endregion - - - bool valueUnchanged = SyncedValue == value; - if (valueUnchanged) { - return; - } - - SyncedValue = value; - - MarkNetworkDirty(); - RequestSerialization(); - NotifyListeners(); - } - get => SyncedValue; - } - - public override void OnPostSerialization(SerializationResult result) { - base.OnPostSerialization(result); - if (!result.success) { - return; - } - - if (autoResetOnSuccess) { - IntValueProperty = 0; - } - } - - public override void OnDeserialization(DeserializationResult deserializationResult) { - base.OnDeserialization(deserializationResult); - NotifyListeners(); - } - - internal void NotifyListeners() { - if (Utilities.IsValid(onChanged)) { - onChanged.Raise(this); - } - - bool listenersInvalid = listeners == null - || targetFieldNames == null - || listeners.Length != targetFieldNames.Length; - if (listenersInvalid) { - Debug.LogError("Invalid listener setup"); - return; - } - - for (int i = 0; i < listeners.Length; i++) { - if (!Utilities.IsValid(listeners[i])) { - Warn($"Invalid listener at index %{i}"); - continue; - } - - listeners[i].SetProgramVariable(targetFieldNames[i], SyncedValue); - } - } - } -} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.cs.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.cs.meta deleted file mode 100644 index 09b06fd..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedInteger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 64b2c7b826b74c6ead3a2d763843fa6a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.asset b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.asset deleted file mode 100644 index 6e5a2a6..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.asset +++ /dev/null @@ -1,1312 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} - m_Name: SyncedIntegerArray - m_EditorClassIdentifier: - serializedUdonProgramAsset: {fileID: 11400000, guid: 4ed017cfa22362448aca86642ffb2af8, - type: 2} - udonAssembly: - assemblyError: - sourceCsScript: {fileID: 11500000, guid: 322e4d4424663004693a5843a0dc2b64, type: 3} - scriptVersion: 2 - compiledVersion: 2 - behaviourSyncMode: 4 - hasInteractEvent: 0 - scriptID: 6833455404583066629 - serializationData: - SerializedFormat: 2 - SerializedBytes: - ReferencedUnityObjects: [] - SerializedBytesString: - Prefab: {fileID: 0} - PrefabModificationsReferencedUnityObjects: [] - PrefabModifications: [] - SerializationNodes: - - Name: fieldDefinitions - Entry: 7 - Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, - UdonSharp.Editor]], mscorlib - - Name: comparer - Entry: 7 - Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, - mscorlib]], mscorlib - - Name: - Entry: 8 - Data: - - Name: - Entry: 12 - Data: 21 - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: $v - Entry: 7 - Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: AutoRetrySendOnFailure - - Name: k__BackingField - Entry: 7 - Data: 3|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Boolean, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Networking - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: If true and a serialization request fails it will automatically try to - send again in the next frame until it succeeds. Only applies to owned objects - and manual sync. - - 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: PauseSynchronization - - Name: $v - Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PauseSynchronization - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 9|UnityEngine.SerializeField, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 10|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Has no effect unless implemented by this particular script. See SyncPaused - property for details. - - 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: Severity - - Name: $v - Entry: 7 - Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Severity - - Name: k__BackingField - Entry: 7 - Data: 12|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.ELogLevel, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 13|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Int32, mscorlib - - Name: - Entry: 8 - Data: - - 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: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 15|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: TLP/Logging - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 16|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 17|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: 'What kind of logs of this behavior shall be produced. Selected severity - includes all more severe levels. Example: selecting ''Warning'' also allows - ''Error'' and ''Assertion'' messages to appear. - - Note: - - ''Debug'' - messages are filtered out by default, even when selected. Add the compiler - definition ''TLP_DEBUG'' in the Unity player settings to enable them. This - should only ever be used for debugging (performance suffers)!' - - 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: PendingSerializations - - Name: $v - Entry: 7 - Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PendingSerializations - - Name: k__BackingField - Entry: 9 - Data: 13 - - Name: k__BackingField - Entry: 9 - Data: 13 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: _hadLogger - - Name: $v - Entry: 7 - Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: _hadLogger - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 21|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: k__BackingField - - Name: $v - Entry: 7 - Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: k__BackingField - - Name: k__BackingField - Entry: 7 - Data: 23|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.Logger.TlpLogger, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 24|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: VRC.Udon.UdonBehaviour, VRC.Udon - - Name: - Entry: 8 - Data: - - 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: false - - Name: _fieldAttributes - Entry: 7 - Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: EventInstigator - - Name: $v - Entry: 7 - Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: EventInstigator - - Name: k__BackingField - Entry: 7 - Data: 27|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: TLP.UdonUtils.Runtime.TlpBaseBehaviour, TLP.UdonUtils.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 29|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 30|UnityEngine.HideInInspector, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 31|JetBrains.Annotations.PublicAPIAttribute, 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: Pool - - Name: $v - Entry: 7 - Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: Pool - - Name: k__BackingField - Entry: 9 - Data: 27 - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: 34|UnityEngine.Serialization.FormerlySerializedAsAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 35|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 36|UnityEngine.HideInInspector, 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: PoolableInUse - - Name: $v - Entry: 7 - Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: PoolableInUse - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 9 - Data: 3 - - 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: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 39|JetBrains.Annotations.PublicAPIAttribute, UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 40|UnityEngine.HideInInspector, 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: syncedValue - - Name: $v - Entry: 7 - Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: syncedValue - - Name: k__BackingField - Entry: 7 - Data: 42|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.Int32[], mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 42 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 3 - Data: 1 - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: true - - Name: _fieldAttributes - Entry: 7 - Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 44|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - - 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: oldValue - - Name: $v - Entry: 7 - Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: oldValue - - Name: k__BackingField - Entry: 9 - Data: 42 - - Name: k__BackingField - Entry: 9 - Data: 42 - - 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: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 47|UnityEngine.HideInInspector, 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: targetBehaviour - - Name: $v - Entry: 7 - Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetBehaviour - - Name: k__BackingField - Entry: 7 - Data: 49|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UdonSharp.UdonSharpBehaviour, UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 24 - - 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: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 51|UnityEngine.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: Target settings - - 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: targetVariable - - Name: $v - Entry: 7 - Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetVariable - - Name: k__BackingField - Entry: 7 - Data: 53|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.String, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 53 - - 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: 54|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: changeEventListeners - - Name: $v - Entry: 7 - Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: changeEventListeners - - Name: k__BackingField - Entry: 7 - Data: 56|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UdonSharp.UdonSharpBehaviour[], UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 57|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Component[], UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - 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.HeaderAttribute, UnityEngine.CoreModule - - Name: header - Entry: 1 - Data: Optional callback events - - 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: targetChangeEvent - - Name: $v - Entry: 7 - Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetChangeEvent - - Name: k__BackingField - Entry: 9 - Data: 53 - - Name: k__BackingField - Entry: 9 - Data: 53 - - 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.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Event to fire on all players when the value changes (instantly called - on the owner) - - 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: preSerializationEventListeners - - Name: $v - Entry: 7 - Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: preSerializationEventListeners - - Name: k__BackingField - Entry: 9 - Data: 56 - - Name: k__BackingField - Entry: 9 - Data: 57 - - 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: 0 - - 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: targetPreSerialization - - Name: $v - Entry: 7 - Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetPreSerialization - - Name: k__BackingField - Entry: 9 - Data: 53 - - Name: k__BackingField - Entry: 9 - Data: 53 - - 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: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 67|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Event to fire on the owner when the value is about to be sent - - 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: deserializeEventListeners - - Name: $v - Entry: 7 - Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: deserializeEventListeners - - Name: k__BackingField - Entry: 9 - Data: 56 - - Name: k__BackingField - Entry: 9 - Data: 57 - - 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: 69|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: targetDeserializeEvent - - Name: $v - Entry: 7 - Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetDeserializeEvent - - Name: k__BackingField - Entry: 9 - Data: 53 - - Name: k__BackingField - Entry: 9 - Data: 53 - - 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: 71|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 72|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Event to fire on non-owning players when a value was received (can be - the same value) - - 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: serializedEventListeners - - Name: $v - Entry: 7 - Data: 73|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: serializedEventListeners - - Name: k__BackingField - Entry: 9 - Data: 56 - - Name: k__BackingField - Entry: 9 - Data: 57 - - 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: 74|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: targetSerializedEvent - - Name: $v - Entry: 7 - Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetSerializedEvent - - Name: k__BackingField - Entry: 9 - Data: 53 - - Name: k__BackingField - Entry: 9 - Data: 53 - - 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: 76|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 1 - - Name: - Entry: 7 - Data: 77|UnityEngine.TooltipAttribute, UnityEngine.CoreModule - - Name: tooltip - Entry: 1 - Data: Event to fire on the owner when the value was successfully sent - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.asset.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.asset.meta deleted file mode 100644 index ee450f7..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fc1c6afa1f3c27442aa8f2000ee9ad59 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.cs deleted file mode 100644 index 22e39d5..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using UdonSharp; -using UnityEngine; -using VRC.SDKBase; -using VRC.Udon.Common; - -namespace TLP.UdonUtils.Runtime.Sync.SyncedVariables -{ - /// - /// Component which is used to synchronize a value on demand independently from high continuous synced udon - /// behaviours to reduce bandwidth. - /// - [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] - [Obsolete("Use sync Events instead", true)] - public class SyncedIntegerArray : TlpBaseBehaviour - { - [UdonSynced] - public int[] syncedValue; - - [HideInInspector] - public int[] oldValue; - - #region Target behaviour - [Header("Target settings")] - /// - /// Udon behaviour that wants to have one of its variables synced to all players - /// - public UdonSharpBehaviour targetBehaviour; - - /// - /// Variable which will get synchronized with all players - /// - public string targetVariable = "values"; - #endregion - - #region Optional Callbacks - [Header("Optional callback events")] - public UdonSharpBehaviour[] changeEventListeners; - - [Tooltip("Event to fire on all players when the value changes (instantly called on the owner)")] - public string targetChangeEvent; - - public UdonSharpBehaviour[] preSerializationEventListeners; - - [Tooltip("Event to fire on the owner when the value is about to be sent")] - public string targetPreSerialization; - - public UdonSharpBehaviour[] deserializeEventListeners; - - [Tooltip("Event to fire on non-owning players when a value was received (can be the same value)")] - public string targetDeserializeEvent; - - public UdonSharpBehaviour[] serializedEventListeners; - - [Tooltip("Event to fire on the owner when the value was successfully sent")] - public string targetSerializedEvent; - #endregion - - /// - /// Triggers Serialization of the manually synced player id. - /// Does nothing if the caller does not own this behaviour/gameobject. - /// - /// false if the local player is not the owner or anything goes wrong - public bool UpdateForAll() { -#if TLP_DEBUG - DebugLog(nameof(UpdateForAll)); -#endif - - var localPlayer = Networking.LocalPlayer; - - if (!Assert(Utilities.IsValid(localPlayer), "Local player invalid", this) - || !Assert( - Utilities.IsValid(localPlayer.IsOwner(gameObject)), - "Local player is not owner", - this - ) - || !Assert(Utilities.IsValid(targetBehaviour), "Target UdonBehaviour invalid", this)) { - return false; - } - - Notify(preSerializationEventListeners, targetPreSerialization); - - object value = targetBehaviour.GetProgramVariable(targetVariable); - if (value != null) { - int[] array = (int[])value; - syncedValue = new int[array.Length]; - array.CopyTo(syncedValue, 0); - } else { - syncedValue = null; - } - - UpdateOldValueAndTriggerChangeEvent(); -#if TLP_DEBUG - DebugLog(nameof(RequestSerialization)); -#endif - RequestSerialization(); - - return true; - } - - private void UpdateOldValueAndTriggerChangeEvent() { - Notify(changeEventListeners, targetChangeEvent); - - if (syncedValue != null) { - int[] temp = new int[syncedValue.Length]; - syncedValue.CopyTo(temp, 0); - oldValue = temp; - } else { - oldValue = null; - } - } - - public override void OnDeserialization(DeserializationResult deserializationResult) { - var localPlayer = Networking.LocalPlayer; - if (localPlayer.IsOwner(gameObject) - || !Utilities.IsValid(targetBehaviour) - || !Utilities.IsValid(localPlayer)) { - return; - } - - // refresh the variable in the target udon behaviour - targetBehaviour.SetProgramVariable(targetVariable, syncedValue); - Notify(deserializeEventListeners, targetDeserializeEvent); - - UpdateOldValueAndTriggerChangeEvent(); - } - - public override void OnPostSerialization(SerializationResult result) { - var localPlayer = Networking.LocalPlayer; - if (!(localPlayer.IsOwner(gameObject) - && Utilities.IsValid(targetBehaviour) - && Utilities.IsValid(localPlayer))) { - Debug.LogWarning($"SyncedInteger.OnPostSerialization: aborting", this); - return; - } - - if (!result.success) { - Debug.LogWarning($"SyncedInteger.OnPostSerialization: Serialization failed, trying again", this); - RequestSerialization(); - return; - } - - Debug.Log($"SyncedInteger.OnPostSerialization: Serialized {result.byteCount} bytes"); - - Notify(serializedEventListeners, targetSerializedEvent); - } - - internal void Notify(UdonSharpBehaviour[] listeners, string eventName) { -#if TLP_DEBUG - DebugLog(nameof(Notify)); -#endif - if (listeners != null && !string.IsNullOrEmpty(eventName)) { - foreach (var preSerializationEventListener in listeners) { - if (Utilities.IsValid(preSerializationEventListener)) { - preSerializationEventListener.SendCustomEvent(eventName); - } - } - } - } - } -} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.cs.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.cs.meta deleted file mode 100644 index 7c956b1..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedIntegerArray.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 322e4d4424663004693a5843a0dc2b64 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.asset b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.asset deleted file mode 100644 index f6f326b..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.asset +++ /dev/null @@ -1,233 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} - m_Name: SyncedString - m_EditorClassIdentifier: - serializedUdonProgramAsset: {fileID: 11400000, guid: 7df8448c8027e6b44b752330af11bb65, - type: 2} - udonAssembly: - assemblyError: - sourceCsScript: {fileID: 11500000, guid: 5664c32cc82142e8a781275e33a01c62, type: 3} - scriptVersion: 2 - compiledVersion: 2 - behaviourSyncMode: 4 - hasInteractEvent: 0 - scriptID: 4254675396319114718 - serializationData: - SerializedFormat: 2 - SerializedBytes: - ReferencedUnityObjects: [] - SerializedBytesString: - Prefab: {fileID: 0} - PrefabModificationsReferencedUnityObjects: [] - PrefabModifications: [] - SerializationNodes: - - Name: fieldDefinitions - Entry: 7 - Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, - UdonSharp.Editor]], mscorlib - - Name: comparer - Entry: 7 - Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, - mscorlib]], mscorlib - - Name: - Entry: 8 - Data: - - Name: - Entry: 12 - Data: 3 - - Name: - Entry: 7 - Data: - - Name: $k - Entry: 1 - Data: SyncedValue - - Name: $v - Entry: 7 - Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: SyncedValue - - Name: k__BackingField - Entry: 7 - Data: 3|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.String, mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 3 - - Name: k__BackingField - Entry: 7 - Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib - - Name: - Entry: 3 - Data: 1 - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 5 - Data: false - - Name: _fieldAttributes - Entry: 7 - Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 2 - - Name: - Entry: 7 - Data: 5|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: - Entry: 7 - Data: 6|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime - - 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: targetFieldNames - - Name: $v - Entry: 7 - Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: targetFieldNames - - Name: k__BackingField - Entry: 7 - Data: 8|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: System.String[], mscorlib - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 9 - Data: 8 - - 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: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - 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: listeners - - Name: $v - Entry: 7 - Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - - Name: k__BackingField - Entry: 1 - Data: listeners - - Name: k__BackingField - Entry: 7 - Data: 11|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UdonSharp.UdonSharpBehaviour[], UdonSharp.Runtime - - Name: - Entry: 8 - Data: - - Name: k__BackingField - Entry: 7 - Data: 12|System.RuntimeType, mscorlib - - Name: - Entry: 1 - Data: UnityEngine.Component[], UnityEngine.CoreModule - - Name: - Entry: 8 - Data: - - 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: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib - - Name: - Entry: 12 - Data: 0 - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 8 - Data: - - Name: - Entry: 13 - Data: - - Name: - Entry: 8 - Data: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.asset.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.asset.meta deleted file mode 100644 index 96cd920..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 548cb24c7a75e3544b589cf062e5e4c5 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.cs b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.cs deleted file mode 100644 index 60dec0d..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using UdonSharp; -using UnityEngine; -using VRC.SDKBase; -using VRC.Udon.Common; - -namespace TLP.UdonUtils.Runtime.Sync.SyncedVariables -{ - [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] - [Obsolete("Use sync Events instead", true)] - public class SyncedString : UdonSharpBehaviour - { - [UdonSynced] - [FieldChangeCallback(nameof(StringValueProperty))] - internal string SyncedValue; - - public string[] targetFieldNames; - public UdonSharpBehaviour[] listeners; - - public string StringValueProperty - { - set - { - bool valueUnchanged = SyncedValue == value; - if (valueUnchanged) { - return; - } - - SyncedValue = value; - - if (Networking.IsOwner(gameObject)) { - RequestSerialization(); - } - - NotifyListeners(); - } - get => SyncedValue; - } - - public override void OnPostSerialization(SerializationResult result) { - if (result.success) { - return; - } - - SendCustomEventDelayedSeconds(nameof(RequestSerialization), 1f); - } - - internal void NotifyListeners() { - bool listenersInvalid = listeners == null - || targetFieldNames == null - || listeners.Length != targetFieldNames.Length; - if (listenersInvalid) { - Debug.LogError("Invalid listener setup"); - return; - } - - for (int i = 0; i < listeners.Length; i++) { - if (Utilities.IsValid(listeners[i])) { - listeners[i].SetProgramVariable(targetFieldNames[i], SyncedValue); - } - } - } - } -} \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.cs.meta b/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.cs.meta deleted file mode 100644 index fd9a8d2..0000000 --- a/Packages/tlp.udonutils/Runtime/Sync/SyncedVariables/SyncedString.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5664c32cc82142e8a781275e33a01c62 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/tlp.udonutils/Runtime/Sync/TimeBacklog.cs b/Packages/tlp.udonutils/Runtime/Sync/TimeBacklog.cs index f6fd92e..5b49224 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TimeBacklog.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TimeBacklog.cs @@ -1,5 +1,7 @@ using System; +using JetBrains.Annotations; using UdonSharp; +using UnityEngine; using VRC.SDK3.Data; namespace TLP.UdonUtils.Runtime.Sync @@ -7,9 +9,16 @@ namespace TLP.UdonUtils.Runtime.Sync /// /// Container for received snapshot data for inter-/extrapolation /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TimeBacklog), ExecutionOrder)] public abstract class TimeBacklog : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TimeSnapshot.ExecutionOrder + 1; + protected readonly DataList _timeStamps = new DataList(); private double _lastAdded = double.MinValue; diff --git a/Packages/tlp.udonutils/Runtime/Sync/TimeSnapshot.cs b/Packages/tlp.udonutils/Runtime/Sync/TimeSnapshot.cs index 06fc8c7..ce5b309 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TimeSnapshot.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TimeSnapshot.cs @@ -1,4 +1,9 @@ +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; +using TLP.UdonUtils.Runtime.Sources; +using TLP.UdonUtils.Runtime.Sources.Time; using UdonSharp; +using UnityEngine; using UnityEngine.Serialization; namespace TLP.UdonUtils.Runtime.Sync @@ -6,9 +11,16 @@ namespace TLP.UdonUtils.Runtime.Sync /// /// Container for a received network snapshot /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TimeSnapshot), ExecutionOrder)] public abstract class TimeSnapshot : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = FrameCountSource.ExecutionOrder + 100; + [FormerlySerializedAs("Time")] public double ServerTime; } diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs index 187300e..8490734 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviour.cs @@ -1,7 +1,9 @@ using System; using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Events; using TLP.UdonUtils.Runtime.Extensions; using TLP.UdonUtils.Runtime.Physics; +using TLP.UdonUtils.Runtime.Recording; using TLP.UdonUtils.Runtime.Sources; using UdonSharp; using UnityEngine; @@ -13,15 +15,16 @@ namespace TLP.UdonUtils.Runtime.Sync /// /// Base Sync Behaviour for movement prediction based on received values from the current owner /// - [DefaultExecutionOrder(ExecutionOrder)] [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TlpAccurateSyncBehaviour), ExecutionOrder)] public abstract class TlpAccurateSyncBehaviour : TlpBaseBehaviour { #region ExecutionOrder protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpBaseBehaviour.ExecutionOrder + 1; + public new const int ExecutionOrder = TransformRecordingPlayer.ExecutionOrder + 1; #endregion #region Dependencies diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs index de819ba..bf9be9f 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourFixedUpdate.cs @@ -1,4 +1,6 @@ -using UnityEngine; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Sync @@ -6,8 +8,15 @@ namespace TLP.UdonUtils.Runtime.Sync /// /// Variant that predicts movement based on /// + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TlpAccurateSyncBehaviourFixedUpdate), ExecutionOrder)] public abstract class TlpAccurateSyncBehaviourFixedUpdate : TlpAccurateSyncBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpAccurateSyncBehaviour.ExecutionOrder + 1; + #region U# Lifecycle public void FixedUpdate() { #region TLP_DEBUG diff --git a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs index a38fec4..3156820 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TlpAccurateSyncBehaviourUpdate.cs @@ -1,12 +1,21 @@ -using VRC.SDKBase; +using JetBrains.Annotations; +using UnityEngine; +using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Sync { /// /// Variant that predicts movement based on /// + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TlpAccurateSyncBehaviourUpdate), ExecutionOrder)] public abstract class TlpAccurateSyncBehaviourUpdate : TlpAccurateSyncBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpAccurateSyncBehaviourFixedUpdate.ExecutionOrder + 1; + #region U# Lifecycle public void Update() { #region TLP_DEBUG diff --git a/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.asset b/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.asset index c792034..4f6f5bf 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.asset +++ b/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: f706993875b1be84ca96f0e338051e72, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 4 hasInteractEvent: 0 scriptID: -7710563581345024871 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.cs b/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.cs index da9a76a..83d2238 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TransformBacklog.cs @@ -1,4 +1,5 @@ -using UdonSharp; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; using VRC.SDK3.Data; @@ -8,9 +9,16 @@ namespace TLP.UdonUtils.Runtime.Sync /// Allows adding position and rotation snapshots for interpolation. /// Note that the time values must be monotonic rising, otherwise adding will fail. /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TransformBacklog), ExecutionOrder)] public class TransformBacklog : TimeBacklog { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TransformSnapshot.ExecutionOrder + 1; + private readonly DataList _positionBackLog = new DataList(); private readonly DataList _rotationBackLog = new DataList(); diff --git a/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.asset b/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.asset index 83f2b06..65e5bce 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.asset +++ b/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 49be51e2d442476f8cb618dc3f6f9c06, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 4 hasInteractEvent: 0 scriptID: 34627433209092921 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.cs b/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.cs index f952bad..51dc61d 100644 --- a/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.cs +++ b/Packages/tlp.udonutils/Runtime/Sync/TransformSnapshot.cs @@ -1,9 +1,21 @@ +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Adapters.Cyan; +using TLP.UdonUtils.Runtime.Events; +using UdonSharp; using UnityEngine; namespace TLP.UdonUtils.Runtime.Sync { + [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TransformSnapshot), ExecutionOrder)] public class TransformSnapshot : TimeSnapshot { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = CyanPoolAdapter.ExecutionOrder + 1; + public Quaternion Rotation; public Vector3 Position; } diff --git a/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.asset b/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.asset index 14b8985..c1797e5 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.asset @@ -21,7 +21,7 @@ MonoBehaviour: compiledVersion: 2 behaviourSyncMode: 4 hasInteractEvent: 0 - scriptID: -5138543174640784772 + scriptID: -6985696161543792955 serializationData: SerializedFormat: 2 SerializedBytes: diff --git a/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.cs b/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.cs index e630107..cac57be 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/LatencyChecker.cs @@ -1,66 +1,78 @@ -using TLP.UdonUtils.Runtime; +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Sources.Time; +using TLP.UdonUtils.Runtime.Sources.Time.Experimental; using TMPro; using UdonSharp; +using UnityEngine; using VRC.SDKBase; using VRC.Udon.Common; -/// -/// Small debug script to display the "true" latency between two players in game time. -/// Should only be used with two players, otherwise it is not clear which two players are used. -/// -[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] -public class LatencyChecker : TlpBaseBehaviour +namespace TLP.UdonUtils.Runtime.Testing { - public TextMeshProUGUI Text; - private TlpNetworkTime _networkTime; + /// + /// Small debug script to display the "true" latency between two players in game time. + /// Should only be used with two players, otherwise it is not clear which two players are used. + /// + [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(LatencyChecker), ExecutionOrder)] + public class LatencyChecker : TlpBaseBehaviour + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; - [UdonSynced] - private double _time; + [PublicAPI] + public new const int ExecutionOrder = NtpTime.ExecutionOrder + 1; - [UdonSynced] - private double _requestTime; + public TextMeshProUGUI Text; + private TlpNetworkTime _networkTime; - protected override bool SetupAndValidate() { - if (!base.SetupAndValidate()) { - return false; - } + [UdonSynced] + private double _time; - _networkTime = TlpNetworkTime.GetInstance(); - if (!Utilities.IsValid(_networkTime)) { - ErrorAndDisableGameObject($"{nameof(_networkTime)} is not set"); - return false; - } + [UdonSynced] + private double _requestTime; - SendCustomEventDelayedSeconds(nameof(Refresh), 1); + protected override bool SetupAndValidate() { + if (!base.SetupAndValidate()) { + return false; + } - return true; - } + _networkTime = TlpNetworkTime.GetInstance(); + if (!Utilities.IsValid(_networkTime)) { + ErrorAndDisableGameObject($"{nameof(_networkTime)} is not set"); + return false; + } - public override void OnOwnershipTransferred(VRCPlayerApi player) { - base.OnOwnershipTransferred(player); - if (Networking.IsOwner(gameObject)) SendCustomEventDelayedSeconds(nameof(Refresh), 1); - } - public void Refresh() { - if (!Networking.IsOwner(gameObject)) return; + return true; + } - _requestTime = _networkTime.TimeAsDouble(); - RequestSerialization(); - SendCustomEventDelayedSeconds(nameof(Refresh), 1); - } + public override void OnOwnershipTransferred(VRCPlayerApi player) { + base.OnOwnershipTransferred(player); + if (Networking.IsOwner(gameObject)) + SendCustomEventDelayedSeconds(nameof(Refresh), 1); + } - public override void OnPreSerialization() { - base.OnPreSerialization(); - _time = _networkTime.TimeAsDouble(); - } + public void Refresh() { + if (!Networking.IsOwner(gameObject)) return; + + _requestTime = _networkTime.TimeAsDouble(); + RequestSerialization(); + SendCustomEventDelayedSeconds(nameof(Refresh), 1); + } - public override void OnDeserialization(DeserializationResult deserializationResult) { - base.OnDeserialization(deserializationResult); - double delta = _networkTime.TimeAsDouble() - _time; - double delta2 = _networkTime.TimeAsDouble() - _time; - Text.text = - $"local: {_networkTime.TimeAsDouble():F6}s\nrequested: {_requestTime:F6}\nreceived: {_time:F6}s\ndelta requested:{delta2:F6}s\ndelta: {delta:F6}s"; + public override void OnPreSerialization() { + base.OnPreSerialization(); + _time = _networkTime.TimeAsDouble(); + } + + public override void OnDeserialization(DeserializationResult deserializationResult) { + base.OnDeserialization(deserializationResult); + double delta = _networkTime.TimeAsDouble() - _time; + double delta2 = _networkTime.TimeAsDouble() - _time; + Text.text = + $"local: {_networkTime.TimeAsDouble():F6}s\nrequested: {_requestTime:F6}\nreceived: {_time:F6}s\ndelta requested:{delta2:F6}s\ndelta: {delta:F6}s"; + } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.asset b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.asset index 6c7cc2d..8c4205f 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.asset @@ -21,7 +21,7 @@ MonoBehaviour: compiledVersion: 2 behaviourSyncMode: 2 hasInteractEvent: 0 - scriptID: -5274969512118970303 + scriptID: 5236254224228047827 serializationData: SerializedFormat: 2 SerializedBytes: @@ -707,7 +707,7 @@ MonoBehaviour: Data: 46|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestResult, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestResult, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: @@ -1043,7 +1043,7 @@ MonoBehaviour: Data: 64|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestMaxSendRateSender[], TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestMaxSendRateSender[], TLP.UdonUtils.Runtime - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.cs b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.cs index 5aafd63..51bbcea 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRate.cs @@ -1,189 +1,199 @@ -using TLP.UdonUtils.Runtime.Common; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.Common; using TLP.UdonUtils.Runtime.Extensions; -using TLP.UdonUtils.Runtime.Testing; using UdonSharp; using UnityEngine; using VRC.SDKBase; using VRC.Udon.Common.Interfaces; -[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] -public class TestMaxSendRate : TestCase +namespace TLP.UdonUtils.Runtime.Testing { - #region Settings - [Range(1, 100)] - public int TargetSendRate = 30; - - [Range(1, 120)] - public float SendDuration = 20f; - - public float AllowedDeviation = 0.05f; - public bool AllowUnsorted; - #endregion - - #region Dependencies - public TestMaxSendRateSender[] TestMaxSendRateSender; - #endregion - - #region TestState - private VRCPlayerApi _otherPlayer; - private float _nextSendTime = float.MinValue; - private float _sendDeltaTime; - private float _lastSendTime = float.MinValue; - private int _senderIndex; - private int _totalValidReceived; - private int _totalOutOfOrderReceived; - private double _lastReceived = double.MinValue; - #endregion - - #region TestCase - protected override void InitializeTest() { - if (TestMaxSendRateSender == null || TestMaxSendRateSender.Length < 1) { - Error("Test requires at least 1 sender"); - TestController.TestInitialized(false); - return; - } - - foreach (var testMaxSendRateSender in TestMaxSendRateSender) { - if (!testMaxSendRateSender) { - Error($"Invalid sender in {nameof(TestMaxSendRateSender)}"); + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestMaxSendRate), ExecutionOrder)] + public class TestMaxSendRate : TestCase + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = NtpAccuracyTester.ExecutionOrder + 1; + + #region Settings + [Range(1, 100)] + public int TargetSendRate = 30; + + [Range(1, 120)] + public float SendDuration = 20f; + + public float AllowedDeviation = 0.05f; + public bool AllowUnsorted; + #endregion + + #region Dependencies + public TestMaxSendRateSender[] TestMaxSendRateSender; + #endregion + + #region TestState + private VRCPlayerApi _otherPlayer; + private float _nextSendTime = float.MinValue; + private float _sendDeltaTime; + private float _lastSendTime = float.MinValue; + private int _senderIndex; + private int _totalValidReceived; + private int _totalOutOfOrderReceived; + private double _lastReceived = double.MinValue; + #endregion + + #region TestCase + protected override void InitializeTest() { + if (TestMaxSendRateSender == null || TestMaxSendRateSender.Length < 1) { + Error("Test requires at least 1 sender"); TestController.TestInitialized(false); return; } - if (testMaxSendRateSender.transform.parent == transform) { - TestMaxSendRateSender[_senderIndex].SendTime = 0; - continue; + foreach (var testMaxSendRateSender in TestMaxSendRateSender) { + if (!testMaxSendRateSender) { + Error($"Invalid sender in {nameof(TestMaxSendRateSender)}"); + TestController.TestInitialized(false); + return; + } + + if (testMaxSendRateSender.transform.parent == transform) { + TestMaxSendRateSender[_senderIndex].SendTime = 0; + continue; + } + + Error( + $"Sender {testMaxSendRateSender.GetComponentPathInScene()} must be a child of {gameObject.transform.GetPathInScene()}"); + TestController.TestInitialized(false); + return; } - Error( - $"Sender {testMaxSendRateSender.GetComponentPathInScene()} must be a child of {gameObject.transform.GetPathInScene()}"); - TestController.TestInitialized(false); - return; - } + if (VRCPlayerApi.GetPlayerCount() != 2) { + Error("Test requires 2 players"); + TestController.TestInitialized(false); + return; + } - if (VRCPlayerApi.GetPlayerCount() != 2) { - Error("Test requires 2 players"); - TestController.TestInitialized(false); - return; - } + var players = new VRCPlayerApi[2]; + VRCPlayerApi.GetPlayers(players); + _otherPlayer = players[0].isLocal ? players[1] : players[0]; - var players = new VRCPlayerApi[2]; - VRCPlayerApi.GetPlayers(players); - _otherPlayer = players[0].isLocal ? players[1] : players[0]; + Networking.SetOwner(_otherPlayer, gameObject); + foreach (var testMaxSendRateSender in TestMaxSendRateSender) { + Networking.SetOwner(_otherPlayer, testMaxSendRateSender.gameObject); + } - Networking.SetOwner(_otherPlayer, gameObject); - foreach (var testMaxSendRateSender in TestMaxSendRateSender) { - Networking.SetOwner(_otherPlayer, testMaxSendRateSender.gameObject); + TestController.TestInitialized(true); } - TestController.TestInitialized(true); - } + protected override void RunTest() { + _totalValidReceived = 0; + _totalOutOfOrderReceived = 0; + SendCustomEventDelayedSeconds(nameof(Delayed_RequestStartSending), 3); + } - protected override void RunTest() { - _totalValidReceived = 0; - _totalOutOfOrderReceived = 0; - SendCustomEventDelayedSeconds(nameof(Delayed_RequestStartSending), 3); - } + protected override void CleanUpTest() { + Networking.SetOwner(Networking.LocalPlayer, gameObject); + foreach (var testMaxSendRateSender in TestMaxSendRateSender) { + Networking.SetOwner(Networking.LocalPlayer, testMaxSendRateSender.gameObject); + } - protected override void CleanUpTest() { - Networking.SetOwner(Networking.LocalPlayer, gameObject); - foreach (var testMaxSendRateSender in TestMaxSendRateSender) { - Networking.SetOwner(Networking.LocalPlayer, testMaxSendRateSender.gameObject); + TestController.TestCleanedUp(true); } + #endregion - TestController.TestCleanedUp(true); - } - #endregion + #region Delayed Events + public void Delayed_RequestStartSending() { + if (Status != TestCaseStatus.Running) return; - #region Delayed Events - public void Delayed_RequestStartSending() { - if (Status != TestCaseStatus.Running) return; + if (!Utilities.IsValid(TestController)) { + Debug.LogError($"'{nameof(TestController)}' is no longer valid"); + return; + } - if (!Utilities.IsValid(TestController)) { - Debug.LogError($"'{nameof(TestController)}' is no longer valid"); - return; - } + if (!Utilities.IsValid(gameObject)) { + Debug.LogError("'GameObject' is no longer valid"); + TestController.TestCompleted(false); + return; + } - if (!Utilities.IsValid(gameObject)) { - Debug.LogError("'GameObject' is no longer valid"); - TestController.TestCompleted(false); - return; - } + if (Networking.IsOwner(gameObject)) { + Error("Local player should not be owner anymore"); + TestController.TestCompleted(false); + return; + } - if (Networking.IsOwner(gameObject)) { - Error("Local player should not be owner anymore"); - TestController.TestCompleted(false); - return; + SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(RPC_StartSending)); + SendCustomEventDelayedSeconds(nameof(Delayed_ExpectTestFinished), SendDuration + 5f); } - SendCustomNetworkEvent(NetworkEventTarget.Owner, nameof(RPC_StartSending)); - SendCustomEventDelayedSeconds(nameof(Delayed_ExpectTestFinished), SendDuration + 5f); - } + public void Delayed_ExpectTestFinished() { + if (Status != TestCaseStatus.Running) return; + if (!Utilities.IsValid(TestController)) { + Debug.LogError($"'{nameof(TestController)}' is no longer valid"); + return; + } - public void Delayed_ExpectTestFinished() { - if (Status != TestCaseStatus.Running) return; - if (!Utilities.IsValid(TestController)) { - Debug.LogError($"'{nameof(TestController)}' is no longer valid"); - return; - } + if (!Utilities.IsValid(gameObject)) { + Debug.LogError("'GameObject' is no longer valid"); + TestController.TestInitialized(false); + return; + } - if (!Utilities.IsValid(gameObject)) { - Debug.LogError("'GameObject' is no longer valid"); - TestController.TestInitialized(false); - return; - } + Info( + $"Received {_totalValidReceived}/{Mathf.RoundToInt(TargetSendRate * SendDuration)} updates, {_totalOutOfOrderReceived} out of expected order"); - Info( - $"Received {_totalValidReceived}/{Mathf.RoundToInt(TargetSendRate * SendDuration)} updates, {_totalOutOfOrderReceived} out of expected order"); + if (Mathf.Abs(_totalValidReceived - Mathf.RoundToInt(TargetSendRate * SendDuration)) < + AllowedDeviation * TargetSendRate * SendDuration) { + TestController.TestCompleted(true); + return; + } - if (Mathf.Abs(_totalValidReceived - Mathf.RoundToInt(TargetSendRate * SendDuration)) < - AllowedDeviation * TargetSendRate * SendDuration) { - TestController.TestCompleted(true); - return; + Error( + $"Expected {Mathf.RoundToInt(TargetSendRate * SendDuration)} updates, " + + $"got {_totalValidReceived} valid updates, " + + $"{_totalOutOfOrderReceived} updates were out of expected order " + + $"({100f - 100f * _totalValidReceived / (TargetSendRate * SendDuration):F3}% deviation, " + + $"allowed was {AllowedDeviation * 100:F3}%)"); + TestController.TestCompleted(false); } + #endregion - Error( - $"Expected {Mathf.RoundToInt(TargetSendRate * SendDuration)} updates, " + - $"got {_totalValidReceived} valid updates, " + - $"{_totalOutOfOrderReceived} updates were out of expected order " + - $"({100f - 100f * _totalValidReceived / (TargetSendRate * SendDuration):F3}% deviation, " + - $"allowed was {AllowedDeviation * 100:F3}%)"); - TestController.TestCompleted(false); - } - #endregion - - #region RPCs - public void RPC_StartSending() { - _sendDeltaTime = 1f / TargetSendRate; - _nextSendTime = Time.time + _sendDeltaTime; - _lastSendTime = Time.time + SendDuration; - } - #endregion + #region RPCs + public void RPC_StartSending() { + _sendDeltaTime = 1f / TargetSendRate; + _nextSendTime = Time.time + _sendDeltaTime; + _lastSendTime = Time.time + SendDuration; + } + #endregion - #region U# Lifecycle - public void Update() { - if (Time.time > _lastSendTime || Time.time < _nextSendTime) return; + #region U# Lifecycle + public void Update() { + if (Time.time > _lastSendTime || Time.time < _nextSendTime) return; - TestMaxSendRateSender[_senderIndex].SendTime = _totalValidReceived; - TestMaxSendRateSender[_senderIndex].RequestSerialization(); - _senderIndex.MoveIndexRightLooping(TestMaxSendRateSender.Length); - _nextSendTime += _sendDeltaTime; - } - #endregion - - - public void ReceivedData(TestMaxSendRateSender sender) { - if (Status != TestCaseStatus.Running) return; - if (Networking.IsOwner(gameObject)) return; - double sendTime = sender.SendTime; - if (sendTime < _lastReceived) { - Warn( - $"Received outdated packet from {sender.GetComponentPathInScene()}: {sendTime:F6} < {_lastReceived:F6}"); - _totalOutOfOrderReceived++; - if (!AllowUnsorted) return; + TestMaxSendRateSender[_senderIndex].SendTime = _totalValidReceived; + TestMaxSendRateSender[_senderIndex].RequestSerialization(); + _senderIndex.MoveIndexRightLooping(TestMaxSendRateSender.Length); + _nextSendTime += _sendDeltaTime; } + #endregion + + + public void ReceivedData(TestMaxSendRateSender sender) { + if (Status != TestCaseStatus.Running) return; + if (Networking.IsOwner(gameObject)) return; + double sendTime = sender.SendTime; + if (sendTime < _lastReceived) { + Warn( + $"Received outdated packet from {sender.GetComponentPathInScene()}: {sendTime:F6} < {_lastReceived:F6}"); + _totalOutOfOrderReceived++; + if (!AllowUnsorted) return; + } - _lastReceived = sendTime; - _totalValidReceived++; + _lastReceived = sendTime; + _totalValidReceived++; + } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.asset b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.asset index 6f0b69e..a6ae2f1 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.asset @@ -21,7 +21,7 @@ MonoBehaviour: compiledVersion: 2 behaviourSyncMode: 4 hasInteractEvent: 0 - scriptID: 6528599812620602297 + scriptID: 8960980690807037338 serializationData: SerializedFormat: 2 SerializedBytes: @@ -761,7 +761,7 @@ MonoBehaviour: Data: 49|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestMaxSendRate, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestMaxSendRate, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.cs b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.cs index 5a03573..63b35d6 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/MaxSendRates/TestMaxSendRateSender.cs @@ -1,44 +1,55 @@ -using TLP.UdonUtils.Runtime; +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Sources; using UdonSharp; +using UnityEngine; using VRC.SDKBase; using VRC.Udon.Common; -[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] -public class TestMaxSendRateSender : TlpBaseBehaviour +namespace TLP.UdonUtils.Runtime.Testing { - public TimeSource TimeSource; + [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestMaxSendRateSender), ExecutionOrder)] + public class TestMaxSendRateSender : TlpBaseBehaviour + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; - [UdonSynced] - public double SendTime; + [PublicAPI] + public new const int ExecutionOrder = TestMaxSendRate.ExecutionOrder + 1; - public TestMaxSendRate Test; + public TimeSource TimeSource; - public override void Start() { - base.Start(); - AutoRetrySendOnFailure = false; - } + [UdonSynced] + public double SendTime; - protected override bool SetupAndValidate() { - if (!base.SetupAndValidate()) { - return false; - } + public TestMaxSendRate Test; - if (!Utilities.IsValid(TimeSource)) { - Error($"{nameof(TimeSource)} is not set"); - return false; + public override void Start() { + base.Start(); + AutoRetrySendOnFailure = false; } - return true; - } + protected override bool SetupAndValidate() { + if (!base.SetupAndValidate()) { + return false; + } - public override void OnPreSerialization() { - base.OnPreSerialization(); - SendTime = TimeSource.TimeAsDouble(); - } + if (!Utilities.IsValid(TimeSource)) { + Error($"{nameof(TimeSource)} is not set"); + return false; + } - public override void OnDeserialization(DeserializationResult result) { - base.OnDeserialization(result); - Test.ReceivedData(this); + return true; + } + + public override void OnPreSerialization() { + base.OnPreSerialization(); + SendTime = TimeSource.TimeAsDouble(); + } + + public override void OnDeserialization(DeserializationResult result) { + base.OnDeserialization(result); + Test.ReceivedData(this); + } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.asset b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.asset index e4bc643..d9869d3 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.asset @@ -21,7 +21,7 @@ MonoBehaviour: compiledVersion: 2 behaviourSyncMode: 4 hasInteractEvent: 0 - scriptID: 4786019476923038265 + scriptID: -5696973184789556255 serializationData: SerializedFormat: 2 SerializedBytes: @@ -707,7 +707,7 @@ MonoBehaviour: Data: 46|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestResult, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestResult, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.cs b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.cs index a36f46e..01dc637 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/NtpAccuracyTest/NtpAccuracyTester.cs @@ -1,146 +1,157 @@ using System; +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Sources; using TLP.UdonUtils.Runtime.Sources.Time; -using TLP.UdonUtils.Runtime.Testing; using UdonSharp; +using UnityEngine; using VRC.SDKBase; using VRC.Udon.Common; -/// -/// Test that the NTP time is the same on two clients and differs at most by 3ms. -/// Requires both players to be running on the same PC so that the UTC time is the same!!! -/// -[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] -public class NtpAccuracyTester : TestCase +namespace TLP.UdonUtils.Runtime.Testing { - public TimeSource TimeSource; - public UtcTimeSource UtcTimeSource; - - [UdonSynced] - public double TesterDelta; + /// + /// Test that the NTP time is the same on two clients and differs at most by 3ms. + /// Requires both players to be running on the same PC so that the UTC time is the same!!! + /// + [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(NtpAccuracyTester), ExecutionOrder)] + public class NtpAccuracyTester : TestCase + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TestGameTimeVsDeltaTime.ExecutionOrder + 1; + + public TimeSource TimeSource; + public UtcTimeSource UtcTimeSource; + + [UdonSynced] + public double TesterDelta; + + protected override void InitializeTest() { + if (!Utilities.IsValid(TimeSource)) { + Error("TimeSource is not set"); + TestController.TestInitialized(false); + return; + } - protected override void InitializeTest() { - if (!Utilities.IsValid(TimeSource)) { - Error("TimeSource is not set"); - TestController.TestInitialized(false); - return; - } + if (!Utilities.IsValid(UtcTimeSource)) { + Error($"{nameof(UtcTimeSource)} is not set"); + TestController.TestInitialized(false); + return; + } - if (!Utilities.IsValid(UtcTimeSource)) { - Error($"{nameof(UtcTimeSource)} is not set"); - TestController.TestInitialized(false); - return; - } + if (VRCPlayerApi.GetPlayerCount() != 2) { + Error("Two players required"); + TestController.TestInitialized(false); + return; + } - if (VRCPlayerApi.GetPlayerCount() != 2) { - Error("Two players required"); - TestController.TestInitialized(false); - return; + TestController.TestInitialized(true); } - TestController.TestInitialized(true); - } + [UdonSynced] + private bool _pendingResponse; - [UdonSynced] - private bool _pendingResponse; + private double _workingTesterDelta; - private double _workingTesterDelta; + protected override void RunTest() { + if (!Networking.IsOwner(gameObject)) { + Networking.SetOwner(Networking.LocalPlayer, gameObject); + } - protected override void RunTest() { - if (!Networking.IsOwner(gameObject)) { - Networking.SetOwner(Networking.LocalPlayer, gameObject); + _pendingResponse = true; + Trigger(0.0); + MarkNetworkDirty(); + RequestSerialization(); + SendCustomEventDelayedSeconds(nameof(Delayed_Timeout), 5f); } - _pendingResponse = true; - Trigger(0.0); - MarkNetworkDirty(); - RequestSerialization(); - SendCustomEventDelayedSeconds(nameof(Delayed_Timeout), 5f); - } + public override void OnDeserialization(DeserializationResult deserializationResult) { + base.OnDeserialization(deserializationResult); - public override void OnDeserialization(DeserializationResult deserializationResult) { - base.OnDeserialization(deserializationResult); + if (TesterDelta <= 0) { + return; + } - if (TesterDelta <= 0) { - return; - } + _workingTesterDelta = TesterDelta; - _workingTesterDelta = TesterDelta; + if (_pendingResponse) { + if (!Networking.IsOwner(gameObject)) { + Networking.SetOwner(Networking.LocalPlayer, gameObject); + } - if (_pendingResponse) { + SendCustomEventDelayedSeconds(nameof(Delayed_Response), 1f); + } else if (Status == TestCaseStatus.Running) { + // player who started the test + Info("Received response from other player"); + Trigger(TesterDelta); + } + } + + public void Delayed_Response() { + // other player if (!Networking.IsOwner(gameObject)) { Networking.SetOwner(Networking.LocalPlayer, gameObject); } - SendCustomEventDelayedSeconds(nameof(Delayed_Response), 1f); - } else if (Status == TestCaseStatus.Running) { - // player who started the test - Info("Received response from other player"); - Trigger(TesterDelta); + _pendingResponse = false; + Trigger(_workingTesterDelta); + Info($"Received delta = {_workingTesterDelta:F9}s"); + Info("Responding to tester"); + MarkNetworkDirty(); + RequestSerialization(); } - } - - public void Delayed_Response() { - // other player - if (!Networking.IsOwner(gameObject)) { - Networking.SetOwner(Networking.LocalPlayer, gameObject); - } - - _pendingResponse = false; - Trigger(_workingTesterDelta); - Info($"Received delta = {_workingTesterDelta:F9}s"); - Info("Responding to tester"); - MarkNetworkDirty(); - RequestSerialization(); - } - public void Delayed_Timeout() { - if (Status == TestCaseStatus.Running) { - Error("Test timed out"); - TestController.TestCompleted(false); + public void Delayed_Timeout() { + if (Status == TestCaseStatus.Running) { + Error("Test timed out"); + TestController.TestCompleted(false); + } } - } - public void Trigger(double testerDelta) { - double serverTime = TimeSource.TimeAsDouble(); - double currentTimeUtc = UtcTimeSource.TimeAsDouble(); + public void Trigger(double testerDelta) { + double serverTime = TimeSource.TimeAsDouble(); + double currentTimeUtc = UtcTimeSource.TimeAsDouble(); - TesterDelta = currentTimeUtc - serverTime; - Info($"currentTimeUtc: {currentTimeUtc:F9}s"); - Info($"TimeSource time: {serverTime:F9}s"); - Info($"Delta: {TesterDelta:F9}s"); - if (testerDelta > 0) { - Info($"Delta of player who started the test: {testerDelta:F9}"); - Info($"Difference: {TesterDelta - testerDelta:F9}"); + TesterDelta = currentTimeUtc - serverTime; + Info($"currentTimeUtc: {currentTimeUtc:F9}s"); + Info($"TimeSource time: {serverTime:F9}s"); + Info($"Delta: {TesterDelta:F9}s"); + if (testerDelta > 0) { + Info($"Delta of player who started the test: {testerDelta:F9}"); + Info($"Difference: {TesterDelta - testerDelta:F9}"); - if (!Utilities.IsValid(TestController)) { - return; - } + if (!Utilities.IsValid(TestController)) { + return; + } - if (Status == TestCaseStatus.Running) { - if (Math.Abs(TesterDelta - testerDelta) > 3e-3) { - Error("Delta between players was more than 3ms"); - TestController.TestCompleted(false); - } else { - Info("Delta was less than 3ms"); - TestController.TestCompleted(true); + if (Status == TestCaseStatus.Running) { + if (Math.Abs(TesterDelta - testerDelta) > 3e-3) { + Error("Delta between players was more than 3ms"); + TestController.TestCompleted(false); + } else { + Info("Delta was less than 3ms"); + TestController.TestCompleted(true); + } } } } - } - protected override void CleanUpTest() { - if (!Networking.IsOwner(gameObject)) { - Networking.SetOwner(Networking.LocalPlayer, gameObject); - } + protected override void CleanUpTest() { + if (!Networking.IsOwner(gameObject)) { + Networking.SetOwner(Networking.LocalPlayer, gameObject); + } - _pendingResponse = false; - TesterDelta = 0; - MarkNetworkDirty(); - RequestSerialization(); - TestController.TestCleanedUp(true); + _pendingResponse = false; + TesterDelta = 0; + MarkNetworkDirty(); + RequestSerialization(); + TestController.TestCleanedUp(true); + } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.asset b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.asset index 4b8ac95..8ec657d 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.asset @@ -19,9 +19,9 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 231a1a6f955a1724599cfdd31a1bc467, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 - scriptID: -5700572998505001197 + scriptID: -305829634495651074 serializationData: SerializedFormat: 2 SerializedBytes: @@ -707,7 +707,7 @@ MonoBehaviour: Data: 46|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestResult, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestResult, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.cs b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.cs index 5200afe..e6810f7 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestGameTimeVsDeltaTime/TestGameTimeVsDeltaTime.cs @@ -1,29 +1,41 @@ -using TLP.UdonUtils.Runtime.Testing; +using JetBrains.Annotations; +using UdonSharp; using UnityEngine; -/// -/// Tests whether on the current frame the deltaTime is the same as the difference -/// between the current game time and the game time of the previous frame. -/// -public class TestGameTimeVsDeltaTime : TestCase +namespace TLP.UdonUtils.Runtime.Testing { - private float _previousGameTime; + /// + /// Tests whether on the current frame the deltaTime is the same as the difference + /// between the current game time and the game time of the previous frame. + /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestGameTimeVsDeltaTime), ExecutionOrder)] + public class TestGameTimeVsDeltaTime : TestCase + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; - protected override void RunTest() { - _previousGameTime = Time.timeSinceLevelLoad; - SendCustomEventDelayedFrames(nameof(EvaluateNextFrame), 1); - } + [PublicAPI] + public new const int ExecutionOrder = TestSanity.ExecutionOrder + 1; - public void EvaluateNextFrame() { - float delta = Time.timeSinceLevelLoad - _previousGameTime; + private float _previousGameTime; - if (Mathf.Abs(delta - Time.deltaTime) > 0.00001f) { - Error($"Delta time is {Time.deltaTime:F6}s but game time delta is {delta:F6}s!"); - TestController.TestCompleted(false); + protected override void RunTest() { + _previousGameTime = Time.timeSinceLevelLoad; + SendCustomEventDelayedFrames(nameof(EvaluateNextFrame), 1); } - Info($"Delta time is {Time.deltaTime:F6}s and game time delta is {delta:F6}s!"); + public void EvaluateNextFrame() { + float delta = Time.timeSinceLevelLoad - _previousGameTime; + + if (Mathf.Abs(delta - Time.deltaTime) > 0.00001f) { + Error($"Delta time is {Time.deltaTime:F6}s but game time delta is {delta:F6}s!"); + TestController.TestCompleted(false); + } - TestController.TestCompleted(true); + Info($"Delta time is {Time.deltaTime:F6}s and game time delta is {delta:F6}s!"); + + TestController.TestCompleted(true); + } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.asset b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.asset index 366dcca..48146be 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.asset @@ -19,9 +19,9 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: d7fba83f9bc75ee4980a697bfff97e6c, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 - scriptID: 7800281751355070606 + scriptID: -1618578376990003453 serializationData: SerializedFormat: 2 SerializedBytes: @@ -707,7 +707,7 @@ MonoBehaviour: Data: 46|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestResult, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestResult, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.cs b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.cs index 96ae92c..7f95135 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/Prefabs/TestSanity/TestSanity.cs @@ -1,8 +1,20 @@ -using TLP.UdonUtils.Runtime.Testing; +using JetBrains.Annotations; +using UdonSharp; +using UnityEngine; -/// -/// Empty test that should always pass. -/// -public class TestSanity : TestCase +namespace TLP.UdonUtils.Runtime.Testing { + /// + /// Empty test that should always pass. + /// + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestSanity), ExecutionOrder)] + public class TestSanity : TestCase + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TestCase.ExecutionOrder + 2; + } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestCase.cs b/Packages/tlp.udonutils/Runtime/Testing/TestCase.cs index 7a3b89f..a62d089 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestCase.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/TestCase.cs @@ -1,7 +1,7 @@ using System; +using JetBrains.Annotations; using UdonSharp; using UnityEngine; -using VRC.SDKBase; namespace TLP.UdonUtils.Runtime.Testing { @@ -20,9 +20,16 @@ public enum TestCaseStatus /// /// Behaviour sync mode can be changed depending on the test performed, default is no variable sync /// - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestCase), ExecutionOrder)] public abstract class TestCase : TlpBaseBehaviour { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TestController.ExecutionOrder + 1; + [NonSerialized] public TestController TestController; diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestController.asset b/Packages/tlp.udonutils/Runtime/Testing/TestController.asset index de500a3..5594b39 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestController.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/TestController.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 633845384acec5440afe0af63e8253f2, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: 4271378112241499094 serializationData: @@ -1322,7 +1322,7 @@ MonoBehaviour: Data: 75|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestData, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestData, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: @@ -1382,7 +1382,7 @@ MonoBehaviour: Data: 79|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestResultsUi, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestResultsUi, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestController.cs b/Packages/tlp.udonutils/Runtime/Testing/TestController.cs index 768364a..011bcc2 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestController.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/TestController.cs @@ -8,14 +8,15 @@ namespace TLP.UdonUtils.Runtime.Testing { - [UdonBehaviourSyncMode(BehaviourSyncMode.None)] + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestController), ExecutionOrder)] public class TestController : Controller { protected override int ExecutionOrderReadOnly => ExecutionOrder; [PublicAPI] - public new const int ExecutionOrder = TlpExecutionOrder.Max; + public new const int ExecutionOrder = TestResult.ExecutionOrder + 1; private const string LogPrefix = "[UdonUtils] [Testing]"; diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestData.asset b/Packages/tlp.udonutils/Runtime/Testing/TestData.asset index c8ac0d2..45d28db 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestData.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/TestData.asset @@ -19,9 +19,9 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 9a5b207cd94211c42b576e7637f4cb2e, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 - scriptID: -4428710603682984575 + scriptID: -4911314509796020105 serializationData: SerializedFormat: 2 SerializedBytes: diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestData.cs b/Packages/tlp.udonutils/Runtime/Testing/TestData.cs index e07fa7a..0a732c7 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestData.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/TestData.cs @@ -1,9 +1,22 @@ -using TLP.UdonUtils.Runtime.DesignPatterns.MVC; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime; +using TLP.UdonUtils.Runtime.DesignPatterns.MVC; using UdonSharp; +using UnityEngine; using VRC.SDK3.Data; -[UdonBehaviourSyncMode(BehaviourSyncMode.None)] -public class TestData : Model +namespace TLP.UdonUtils.Runtime.Testing { - public DataList Tests = new DataList(); + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestData), ExecutionOrder)] + public class TestData : Model + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = TlpExecutionOrder.TestingStart + 1; + + public DataList Tests = new DataList(); + } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestResult.asset b/Packages/tlp.udonutils/Runtime/Testing/TestResult.asset index 7742fb6..5ef8714 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestResult.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/TestResult.asset @@ -19,9 +19,9 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: d656590cb19ce0d439aaec2eea2dc5bb, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 - scriptID: -7470338000787004024 + scriptID: 2036762268884477959 serializationData: SerializedFormat: 2 SerializedBytes: diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestResult.cs b/Packages/tlp.udonutils/Runtime/Testing/TestResult.cs index 00edd64..31bee0c 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestResult.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/TestResult.cs @@ -1,68 +1,79 @@ -using TLP.UdonUtils.Runtime; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime; using TLP.UdonUtils.Runtime.Testing; using TMPro; using UdonSharp; using UnityEngine; using UnityEngine.UI; -[UdonBehaviourSyncMode(BehaviourSyncMode.None)] -public class TestResult : TlpBaseBehaviour +namespace TLP.UdonUtils.Runtime.Testing { - [SerializeField] - private TextMeshProUGUI Id; + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestResult), ExecutionOrder)] + public class TestResult : TlpBaseBehaviour + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; - [SerializeField] - private TextMeshProUGUI Title; + [PublicAPI] + public new const int ExecutionOrder = TestData.ExecutionOrder + 1; - [SerializeField] - private TextMeshProUGUI ButtonText; + [SerializeField] + private TextMeshProUGUI Id; - [SerializeField] - private TextMeshProUGUI Status; + [SerializeField] + private TextMeshProUGUI Title; - [SerializeField] - private Image Background; + [SerializeField] + private TextMeshProUGUI ButtonText; - public void Initialize(TestCase testCase) { - #region TLP_DEBUG + [SerializeField] + private TextMeshProUGUI Status; + + [SerializeField] + private Image Background; + + public void Initialize(TestCase testCase) { + #region TLP_DEBUG #if TLP_DEBUG - DebugLog(nameof(Initialize)); + DebugLog(nameof(Initialize)); #endif - #endregion + #endregion - Id.text = testCase.transform.GetSiblingIndex().ToString(); - Title.text = testCase.name; + Id.text = testCase.transform.GetSiblingIndex().ToString(); + Title.text = testCase.name; - ButtonText.text = "Start"; - Background.color = Color.gray; - switch (testCase.Status) { - case TestCaseStatus.Ready: - Status.text = "Ready"; - break; - case TestCaseStatus.Running: - Status.text = "Running"; - Background.color = Color.blue; - break; - case TestCaseStatus.Passed: - Status.text = "Pass"; - Background.color = Color.green; - break; - case TestCaseStatus.Failed: - Status.text = "Fail"; - Background.color = Color.red; - break; - case TestCaseStatus.NotRun: - Status.text = "-"; - Background.color = Color.yellow; - break; - default: - Status.text = "Unknown"; - Background.color = Color.magenta; - break; - } + ButtonText.text = "Start"; + Background.color = Color.gray; + switch (testCase.Status) { + case TestCaseStatus.Ready: + Status.text = "Ready"; + break; + case TestCaseStatus.Running: + Status.text = "Running"; + Background.color = Color.blue; + break; + case TestCaseStatus.Passed: + Status.text = "Pass"; + Background.color = Color.green; + break; + case TestCaseStatus.Failed: + Status.text = "Fail"; + Background.color = Color.red; + break; + case TestCaseStatus.NotRun: + Status.text = "-"; + Background.color = Color.yellow; + break; + default: + Status.text = "Unknown"; + Background.color = Color.magenta; + break; + } - testCase.Result = this; - name = $"TableEntry_{testCase.name}"; + testCase.Result = this; + name = $"TableEntry_{testCase.name}"; + } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.asset b/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.asset index bb23361..0808865 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.asset +++ b/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.asset @@ -19,9 +19,9 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: 45cdfde692d915745bfef9a9443dd165, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 - scriptID: -4730145038717998739 + scriptID: 2140935364378287599 serializationData: SerializedFormat: 2 SerializedBytes: @@ -959,7 +959,7 @@ MonoBehaviour: Data: 58|System.RuntimeType, mscorlib - Name: Entry: 1 - Data: TestResult, TLP.UdonUtils.Runtime + Data: TLP.UdonUtils.Runtime.Testing.TestResult, TLP.UdonUtils.Runtime - Name: Entry: 8 Data: diff --git a/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.cs b/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.cs index be7e3de..ae61652 100644 --- a/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.cs +++ b/Packages/tlp.udonutils/Runtime/Testing/TestResultsUi.cs @@ -1,65 +1,76 @@ -using TLP.UdonUtils.Runtime.DesignPatterns.MVC; +using JetBrains.Annotations; +using TLP.UdonUtils.Runtime.DesignPatterns.MVC; using TLP.UdonUtils.Runtime.Testing; using UdonSharp; using UnityEngine; using VRC.SDK3.Data; -[UdonBehaviourSyncMode(BehaviourSyncMode.None)] -public class TestResultsUi : View +namespace TLP.UdonUtils.Runtime.Testing { - [SerializeField] - internal TestResult Prefab; + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TestResultsUi), ExecutionOrder)] + public class TestResultsUi : View + { + protected override int ExecutionOrderReadOnly => ExecutionOrder; - [SerializeField] - private RectTransform ContentPanel; + [PublicAPI] + public new const int ExecutionOrder = DummyView.ExecutionOrder + 1; - private DataDictionary _testEntries = new DataDictionary(); + [SerializeField] + internal TestResult Prefab; - public override void OnModelChanged() { - #region TLP_DEBUG + [SerializeField] + private RectTransform ContentPanel; + + private readonly DataDictionary _testEntries = new DataDictionary(); + + public override void OnModelChanged() { + #region TLP_DEBUG #if TLP_DEBUG - DebugLog(nameof(OnModelChanged)); + DebugLog(nameof(OnModelChanged)); #endif - #endregion + #endregion - var testData = (TestData)Model; - int tests = testData.Tests.Count; + var testData = (TestData)Model; + int tests = testData.Tests.Count; - float rectHeight = ((RectTransform)Prefab.transform).rect.height; - ContentPanel.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectHeight * tests); + float rectHeight = ((RectTransform)Prefab.transform).rect.height; + ContentPanel.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectHeight * tests); - for (int i = 0; i < tests; i++) { - var testCase = (TestCase)testData.Tests[i].Reference; - if (_testEntries.ContainsKey(testCase)) { - ((TestResult)_testEntries[testCase].Reference).Initialize(testCase); - continue; - } + for (int i = 0; i < tests; i++) { + var testCase = (TestCase)testData.Tests[i].Reference; + if (_testEntries.ContainsKey(testCase)) { + ((TestResult)_testEntries[testCase].Reference).Initialize(testCase); + continue; + } - var newEntry = Instantiate(Prefab.gameObject, ContentPanel); - var newTestResult = newEntry.transform.GetComponent(); - _testEntries.Add(testCase, newTestResult); + var newEntry = Instantiate(Prefab.gameObject, ContentPanel); + var newTestResult = newEntry.transform.GetComponent(); + _testEntries.Add(testCase, newTestResult); - newTestResult.Initialize(testCase); - var newEntryTransform = newTestResult.transform; - var transformLocalPosition = newEntryTransform.localPosition; - newEntryTransform.localPosition = new Vector3( - transformLocalPosition.x, - -i * rectHeight, - transformLocalPosition.z - ); - newTestResult.gameObject.SetActive(true); - DebugLog("Added test result entry"); + newTestResult.Initialize(testCase); + var newEntryTransform = newTestResult.transform; + var transformLocalPosition = newEntryTransform.localPosition; + newEntryTransform.localPosition = new Vector3( + transformLocalPosition.x, + -i * rectHeight, + transformLocalPosition.z + ); + newTestResult.gameObject.SetActive(true); + DebugLog("Added test result entry"); + } } - } - protected override bool InitializeInternal() { - if (!Prefab) { - Error($"{nameof(Prefab)} not set"); - return false; - } + protected override bool InitializeInternal() { + if (!Prefab) { + Error($"{nameof(Prefab)} not set"); + return false; + } - Prefab.gameObject.SetActive(false); + Prefab.gameObject.SetActive(false); - return base.InitializeInternal(); + return base.InitializeInternal(); + } } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/Tests/TestFactory.asset b/Packages/tlp.udonutils/Runtime/Tests/TestFactory.asset index 13500a0..9b80d13 100644 --- a/Packages/tlp.udonutils/Runtime/Tests/TestFactory.asset +++ b/Packages/tlp.udonutils/Runtime/Tests/TestFactory.asset @@ -19,7 +19,7 @@ MonoBehaviour: sourceCsScript: {fileID: 11500000, guid: c6cd657171954a81a092a5c91c65c8b7, type: 3} scriptVersion: 2 compiledVersion: 2 - behaviourSyncMode: 1 + behaviourSyncMode: 2 hasInteractEvent: 0 scriptID: -6713776411541606312 serializationData: diff --git a/Packages/tlp.udonutils/Runtime/Tests/TestFactory.cs b/Packages/tlp.udonutils/Runtime/Tests/TestFactory.cs index 07755aa..ddc98bf 100644 --- a/Packages/tlp.udonutils/Runtime/Tests/TestFactory.cs +++ b/Packages/tlp.udonutils/Runtime/Tests/TestFactory.cs @@ -1,10 +1,17 @@ +using JetBrains.Annotations; using TLP.UdonUtils.Runtime.Factories; +using TLP.UdonUtils.Runtime.Pool; using UnityEngine; namespace TLP.UdonUtils.Runtime.Tests { public class TestFactory : TlpFactory { + protected override int ExecutionOrderReadOnly => ExecutionOrder; + + [PublicAPI] + public new const int ExecutionOrder = FactoryWithPool.ExecutionOrder + 1; + protected override GameObject ProduceInstance() { var instance = Instantiate(gameObject); DestroyImmediate(instance.gameObject.GetComponent()); diff --git a/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs b/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs index 82df614..0d5eb78 100644 --- a/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs +++ b/Packages/tlp.udonutils/Runtime/TlpBaseBehaviour.cs @@ -36,6 +36,7 @@ namespace TLP.UdonUtils.Runtime /// https://docs.vrchat.com/docs/event-execution-order /// [DefaultExecutionOrder(ExecutionOrder)] + [TlpDefaultExecutionOrder(typeof(TlpBaseBehaviour), ExecutionOrder)] public abstract class TlpBaseBehaviour : UdonSharpBehaviour { protected virtual int ExecutionOrderReadOnly => ExecutionOrder; @@ -250,6 +251,9 @@ public virtual void Start() { #region TLP_DEBUG #if TLP_DEBUG DebugLog(nameof(Start)); + if (Utilities.IsValid(Networking.LocalPlayer)) { + AssertExecutionOrderCorrect(); + } #endif #endregion @@ -407,34 +411,9 @@ private bool GetLogger() { /// Compact error message, will be surrounded by context info /// Object which is relevant to the condition failing, usually a behaviour or GameObject /// The value of condition - [Obsolete("Use Assert(bool condition, string message) instead")] + [Obsolete("Use Assert(bool condition, string message) instead", true)] protected bool Assert(bool condition, string message, Object context) { -#if !TLP_DEBUG - return condition; -#else - if ((int)Severity < (int)ELogLevel.Assertion) { - return condition; - } - - if (condition) { - return true; - } - - if (Utilities.IsValid(context)) { - var udonSharpBehaviour = (UdonSharpBehaviour)context; - // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression - if (Utilities.IsValid(udonSharpBehaviour)) { - Error($"Assertion failed : '{udonSharpBehaviour.gameObject.name} : {message}'"); - } else { - Error($"Assertion failed : '{context.GetType()} : {message}'"); - } - } else { - Error("Assertion failed : '" + message + "'"); - } - - Debug.Assert(condition, message); return false; -#endif } [Conditional("TLP_DEBUG")] @@ -527,6 +506,47 @@ private static bool MissingLoggerLogged() { return localPlayer.GetPlayerTag(PlayerTagTlpLoggerMissingLogged) == "true"; } + + private void AssertExecutionOrderCorrect() { + const string playerTagExecOrder = "TLP/Base/ExecOrder"; + const string playerTagLastFrameStart = "TLP/Base/LastFrameStart"; + const string playerTagLastFrameBehaviour = "TLP/Base/LastFrameBehaviour"; + string lastStarted = Networking.LocalPlayer.GetPlayerTag(playerTagExecOrder); + string lastFrameStart = Networking.LocalPlayer.GetPlayerTag(playerTagLastFrameStart); + string lastFrameBehaviour = Networking.LocalPlayer.GetPlayerTag(playerTagLastFrameBehaviour); + ValidateStartOrder(lastFrameStart, lastStarted, lastFrameBehaviour); + Networking.LocalPlayer.SetPlayerTag(playerTagExecOrder, ExecutionOrderReadOnly.ToString()); + Networking.LocalPlayer.SetPlayerTag(playerTagLastFrameStart, Time.frameCount.ToString()); + Networking.LocalPlayer.SetPlayerTag(playerTagLastFrameBehaviour, GetUdonTypeName()); + } + + private void ValidateStartOrder( string lastFrameStart, string lastStarted, string lastBehaviour) { + if (string.IsNullOrEmpty(lastFrameStart)) { + return; + } + + if (!int.TryParse(lastFrameStart, out int savedFrame)) { + return; + } + + if (savedFrame != Time.frameCount) { + return; + } + + if (string.IsNullOrEmpty(lastStarted)) { + return; + } + + if (!int.TryParse(lastStarted, out int execOrder)) { + return; + } + + if (lastBehaviour != GetUdonTypeName() && ExecutionOrderReadOnly <= execOrder) { + Warn($"Received Start() in incorrect order, previously started script '{lastBehaviour}' in this frame had " + + $"ExecutionOrder {execOrder} while {GetUdonTypeName()} has ExecutionOrder {ExecutionOrderReadOnly}. " + + $"Please add [TlpDefaultExecutionOrder(ExecutionOrder)] to this script or the script that started before this one."); + } + } #endregion } } \ No newline at end of file diff --git a/Packages/tlp.udonutils/Runtime/TlpExecutionOrder.cs b/Packages/tlp.udonutils/Runtime/TlpExecutionOrder.cs index c9e7da9..e31c643 100644 --- a/Packages/tlp.udonutils/Runtime/TlpExecutionOrder.cs +++ b/Packages/tlp.udonutils/Runtime/TlpExecutionOrder.cs @@ -1,11 +1,17 @@ +using VRC.SDK3.Data; + namespace TLP.UdonUtils.Runtime { public static class TlpExecutionOrder { public const int Min = int.MinValue + 1_000_000; - public const int Max = AudioEnd + 1; + public const int Max = TestingEnd + 1; public const int DefaultOffset = 150_000; + public const int WorldInitStart = -3_000 + DefaultOffset; + public const int WorldInitEnd = -2_001 + DefaultOffset; + public const int TimeSourcesStart = -2_000 + DefaultOffset; + public const int TimeSourcesEnd = -1_001 + DefaultOffset; public const int DirectInputStart = -1_000 + DefaultOffset; public const int DirectInputEnd = -1 + DefaultOffset; public const int DefaultStart = 0 + DefaultOffset; @@ -20,5 +26,37 @@ public static class TlpExecutionOrder public const int UiEnd = 10_999 + DefaultOffset; public const int AudioStart = 11_000 + DefaultOffset; public const int AudioEnd = 11_999 + DefaultOffset; + public const int RecordingStart = 12_000 + DefaultOffset; + public const int RecordingEnd = 12_999 + DefaultOffset; + public const int TestingStart = 13_000 + DefaultOffset; + public const int TestingEnd = 13_999 + DefaultOffset; + + public static readonly DataDictionary s_All = new DataDictionary() + { + { Min, nameof(Min) }, + { WorldInitStart, nameof(WorldInitStart) }, + { WorldInitEnd, nameof(WorldInitEnd) }, + { TimeSourcesStart, nameof(TimeSourcesStart) }, + { TimeSourcesEnd, nameof(TimeSourcesEnd) }, + { DirectInputStart, nameof(DirectInputStart) }, + { DirectInputEnd, nameof(DirectInputEnd) }, + { DefaultStart, nameof(DefaultStart) }, + { DefaultEnd, nameof(DefaultEnd) }, + { VehicleMotionStart, nameof(VehicleMotionStart) }, + { VehicleMotionEnd, nameof(VehicleMotionEnd) }, + { PlayerMotionStart, nameof(PlayerMotionStart) }, + { PlayerMotionEnd, nameof(PlayerMotionEnd) }, + { WeaponsStart, nameof(WeaponsStart) }, + { WeaponsEnd, nameof(WeaponsEnd) }, + { UiStart, nameof(UiStart) }, + { UiEnd, nameof(UiEnd) }, + { AudioStart, nameof(AudioStart) }, + { AudioEnd, nameof(AudioEnd) }, + { RecordingStart, nameof(RecordingStart) }, + { RecordingEnd, nameof(RecordingEnd) }, + { TestingStart, nameof(TestingStart) }, + { TestingEnd, nameof(TestingEnd) }, + { Max, nameof(Max) }, + }; } -} \ No newline at end of file +} diff --git a/Packages/tlp.udonutils/package.json b/Packages/tlp.udonutils/package.json index 9a94f5b..aed2a18 100644 --- a/Packages/tlp.udonutils/package.json +++ b/Packages/tlp.udonutils/package.json @@ -1,7 +1,7 @@ { "name": "tlp.udonutils", "displayName": "TLP UdonUtils", - "version": "9.0.0", + "version": "10.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 6d690b5..1289005 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,17 @@ The used pattern MAJOR.MINOR.PATCH indicates: All notable changes to this project will be documented in this file. +### [10.0.0] - 2024-11-02 + +#### 🚀 Features + +- *(StateMachine)* Add transtion to delayed method to statemachine +- [**breaking**] Deterministic execution order of scripts to address know VRC-bug + +#### 🐛 Bug Fixes + +- *(RigidbodyVelocityProvider)* Add missing dependency validation + ### [9.0.0] - 2024-08-20 #### 🚀 Features