Working well now I think?

This commit is contained in:
2026-01-12 21:00:49 +01:00
parent e76df964e5
commit da0e6699e7
5 changed files with 609 additions and 552 deletions

View File

@@ -43,7 +43,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 19
Data: 21
- Name:
Entry: 7
Data:
@@ -265,118 +265,16 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: lastEventTimestamp
Data: retriesWithoutSuccess
- Name: $v
Entry: 7
Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastEventTimestamp
- Name: <UserType>k__BackingField
Entry: 9
Data: 8
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 15|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: lastEventId
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastEventId
- Name: <UserType>k__BackingField
Entry: 7
Data: 17|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 17
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 18|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: retriesWithoutSuccess
- Name: $v
Entry: 7
Data: 19|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: retriesWithoutSuccess
- Name: <UserType>k__BackingField
Entry: 7
Data: 20|System.RuntimeType, mscorlib
Data: 15|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
@@ -385,7 +283,109 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 20
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 16|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: hasFullSyncReady
- Name: $v
Entry: 7
Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: hasFullSyncReady
- Name: <UserType>k__BackingField
Entry: 7
Data: 18|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 18
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>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: serializationRequested
- Name: $v
Entry: 7
Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: serializationRequested
- Name: <UserType>k__BackingField
Entry: 9
Data: 18
- Name: <SystemType>k__BackingField
Entry: 9
Data: 18
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -421,70 +421,16 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: fullSyncInQueue
Data: eventsQueue
- Name: $v
Entry: 7
Data: 22|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: fullSyncInQueue
Data: eventsQueue
- Name: <UserType>k__BackingField
Entry: 7
Data: 23|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 24|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: buffer
- Name: $v
Entry: 7
Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: buffer
- Name: <UserType>k__BackingField
Entry: 7
Data: 26|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte[][], mscorlib
@@ -493,7 +439,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 27|System.RuntimeType, mscorlib
Data: 24|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Object[], mscorlib
@@ -514,7 +460,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -535,19 +481,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: bufferIndex
Data: eventsQueueIndex
- Name: $v
Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: bufferIndex
Data: eventsQueueIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 20
Data: 15
- Name: <SystemType>k__BackingField
Entry: 9
Data: 20
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -562,7 +508,211 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 30|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 27|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: eventsQueueIndexAtLastTransmission
- Name: $v
Entry: 7
Data: 28|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventsQueueIndexAtLastTransmission
- Name: <UserType>k__BackingField
Entry: 9
Data: 15
- Name: <SystemType>k__BackingField
Entry: 9
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 29|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: eventTransmissionHistory
- Name: $v
Entry: 7
Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventTransmissionHistory
- Name: <UserType>k__BackingField
Entry: 7
Data: 31|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 31
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 32|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: eventTransmissionHistoryIndex
- Name: $v
Entry: 7
Data: 33|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: eventTransmissionHistoryIndex
- Name: <UserType>k__BackingField
Entry: 9
Data: 15
- Name: <SystemType>k__BackingField
Entry: 9
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 34|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: lastEventId
- Name: $v
Entry: 7
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastEventId
- Name: <UserType>k__BackingField
Entry: 7
Data: 36|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 36
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -586,13 +736,13 @@ MonoBehaviour:
Data: networkedData
- Name: $v
Entry: 7
Data: 31|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: networkedData
- Name: <UserType>k__BackingField
Entry: 7
Data: 32|System.RuntimeType, mscorlib
Data: 39|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Byte[], mscorlib
@@ -601,7 +751,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 32
Data: 39
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -616,13 +766,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 34|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 41|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -646,16 +796,16 @@ MonoBehaviour:
Data: <Ready>k__BackingField
- Name: $v
Entry: 7
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <Ready>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -670,7 +820,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 43|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -694,16 +844,16 @@ MonoBehaviour:
Data: <Synced>k__BackingField
- Name: $v
Entry: 7
Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <Synced>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -718,7 +868,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 38|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
@@ -742,7 +892,7 @@ MonoBehaviour:
Data: <SyncedTime>k__BackingField
- Name: $v
Entry: 7
Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <SyncedTime>k__BackingField
@@ -766,7 +916,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 40|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
@@ -790,7 +940,7 @@ MonoBehaviour:
Data: <Dt>k__BackingField
- Name: $v
Entry: 7
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 48|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <Dt>k__BackingField
@@ -814,7 +964,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 49|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -838,16 +988,16 @@ MonoBehaviour:
Data: <IsEventUpdate>k__BackingField
- Name: $v
Entry: 7
Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <IsEventUpdate>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -862,7 +1012,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 44|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
@@ -886,16 +1036,16 @@ MonoBehaviour:
Data: <IsOwner>k__BackingField
- Name: $v
Entry: 7
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: <IsOwner>k__BackingField
- Name: <UserType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SystemType>k__BackingField
Entry: 9
Data: 23
Data: 18
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -910,55 +1060,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 46|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: indexAtLastSerialization
- Name: $v
Entry: 7
Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: indexAtLastSerialization
- Name: <UserType>k__BackingField
Entry: 9
Data: 20
- Name: <SystemType>k__BackingField
Entry: 9
Data: 20
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 48|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -982,13 +1084,13 @@ MonoBehaviour:
Data: DebugImageToIndicateOwner
- Name: $v
Entry: 7
Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: DebugImageToIndicateOwner
- Name: <UserType>k__BackingField
Entry: 7
Data: 50|System.RuntimeType, mscorlib
Data: 55|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
@@ -997,7 +1099,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 50
Data: 55
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1012,13 +1114,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 56|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 52|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 57|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:

View File

@@ -1,25 +1,20 @@
using Cysharp.Threading.Tasks.Triggers;
using JetBrains.Annotations;
using System;
using System.Drawing;
using System.Linq;
using System;
using System.Reflection;
using System.Text;
using TMPro;
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon.ClientBindings.Interfaces;
using VRC.Udon.Common;
namespace Marro.PacManUdon
{
public enum NetworkEventType
{
FullSync = 0,
PacManTurn = 1,
FullSyncForced = 0,
FullSync = 1,
PacManTurn = 2,
}
public class NetworkManager : UdonSharpBehaviour
@@ -76,6 +71,10 @@ namespace Marro.PacManUdon
/// The delay at which the receiving side replays events.
/// </summary>
private const float Delay = 1f;
/// <summary>
/// The maximum amount of times a message is sent
/// </summary>
private const int MaxEventSendTries = 3;
#endregion
#region Private attributes
@@ -98,33 +97,47 @@ namespace Marro.PacManUdon
/// </summary>
private float nextEventTime;
/// <summary>
/// The timestamp of the most recent event created or received.
/// </summary>
private float lastEventTimestamp;
/// <summary>
/// The message id of the most recent event created or received.
/// </summary>
private byte lastEventId;
/// <summary>
/// Amounot of retries in a row without a successful sync.
/// </summary>
private int retriesWithoutSuccess;
/// <summary>
/// True if there is a full sync in the queue and we are not currently synced.
/// For receiver: True if there's a full sync in the queue and we are not synced, otherwise false.
/// For transmitter: True if there's a full sync in the queue which has not yet been transmitted, otherwise false.
/// </summary>
private bool fullSyncInQueue;
private bool hasFullSyncReady;
/// <summary>
/// True if serialization has been requestsed
/// </summary>
private bool serializationRequested;
/// <summary>
/// Main buffer of data to be transmitted or processed
/// Queue of events to be transmitted or processed
/// </summary>
private byte[][] buffer;
private byte[][] eventsQueue;
/// <summary>
/// Index of <see cref="buffer"/>.
/// Index of <see cref="eventsQueue"/>.
/// </summary>
private int bufferIndex;
private int eventsQueueIndex;
/// <summary>
/// The value of <see cref="eventsQueueIndex"/> at the last transmission
/// </summary>
private int eventsQueueIndexAtLastTransmission;
/// <summary>
/// Counts of new events at recent transmissions
/// </summary>
private int[] eventTransmissionHistory;
/// <summary>
/// Index of <see cref="eventTransmissionHistoryIndex"/>
/// </summary>
private int eventTransmissionHistoryIndex;
/// <summary>
/// The message id of the most recent event created or received.
/// </summary>
private byte lastEventId;
/// <summary>
/// Data which is currently available on the network.
@@ -184,13 +197,11 @@ namespace Marro.PacManUdon
SetOwner(Networking.IsOwner(gameObject));
buffer = new byte[BufferMaxTotalEvents][];
bufferIndex = 0;
ClearBuffer();
Synced = IsOwner; // Owner is always synced
retriesWithoutSuccess = 0;
lastEventTimestamp = 0;
lastEventId = 0;
fullSyncInQueue = false;
hasFullSyncReady = false;
offsetTime = Time.fixedTime;
internalTime = 0;
@@ -259,7 +270,7 @@ namespace Marro.PacManUdon
}
else
{
SendEvent(NetworkEventType.FullSync);
SendEvent(NetworkEventType.FullSyncForced);
}
}
@@ -291,7 +302,7 @@ namespace Marro.PacManUdon
var timestamp = SyncedTime;
var eventId = GetNextEventId(lastEventId);
InitializeEvent(eventType, timestamp, eventId, BufferMaxTotalEvents, out byte[][] data, out var index);
foreach (var obj in syncedObjects)
@@ -299,8 +310,6 @@ namespace Marro.PacManUdon
obj.AppendSyncedData(data, ref index, eventType);
}
var oldIndex = this.bufferIndex;
var result = Flatten(data, 0, index);
// Validate and fill in event size
@@ -316,13 +325,17 @@ namespace Marro.PacManUdon
var eventSizeBytes = BitConverter.GetBytes((ushort)eventSize);
Array.Copy(eventSizeBytes, 0, result, HeaderEventSizeIndex, eventSizeBytes.Length);
if (IsFullSync(eventType))
{
hasFullSyncReady = true;
}
QueueEventInBuffer(result);
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Prepared event with {eventSize} bytes and timestamp {timestamp} for serialization, index went from {oldIndex} to {this.bufferIndex}");
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Prepared event with {eventSize} bytes and timestamp {timestamp} for serialization, index is now {this.eventsQueueIndex}");
RequestSerialization();
RequestSerializationForEvents();
lastEventTimestamp = timestamp;
lastEventId = eventId;
retriesWithoutSuccess = 0; // We had success!
@@ -346,6 +359,12 @@ namespace Marro.PacManUdon
index = 1;
}
private void RequestSerializationForEvents()
{
RequestSerialization();
serializationRequested = true;
}
[NetworkCallable]
public void RequestEventReceived(NetworkEventType eventType)
{
@@ -354,8 +373,65 @@ namespace Marro.PacManUdon
return;
}
if (IsFullSync(eventType) && hasFullSyncReady)
{
return; // Don't send another full sync if we're already preparing to send one
}
if (eventType == NetworkEventType.FullSyncForced)
{
SendEvent(NetworkEventType.FullSync); // Remote is not allowed to request a forced full sync
}
SendEvent(eventType);
}
public override void OnPreSerialization()
{
if (!Ready || !IsOwner || !serializationRequested || eventsQueue == null || eventsQueueIndex == 0)
{
return;
}
networkedData = Flatten(eventsQueue, 0, eventsQueueIndex);
eventTransmissionHistory[eventTransmissionHistoryIndex] = eventsQueueIndex - eventsQueueIndexAtLastTransmission;
eventTransmissionHistoryIndex += 1;
if (eventTransmissionHistoryIndex >= eventTransmissionHistory.Length)
{
eventTransmissionHistoryIndex = 0;
}
serializationRequested = false;
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serializing {eventsQueueIndex} event(s), eventTransmissionHistory is now {ArrayToString(eventTransmissionHistory)} with index {eventTransmissionHistoryIndex}");
}
public override void OnPostSerialization(SerializationResult result)
{
if (!Ready || !IsOwner || networkedData.Length == 0)
{
return;
}
if (!result.success)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serialization failed! Tried to send {result.byteCount} bytes.");
return;
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serialized with {networkedData.Length} bytes.\nBytes sent:\n{ArrayToString(networkedData)}");
// Remove data from the buffer that no longer needs to be (re)transmitted
DequeueEventsFromBuffer(eventTransmissionHistory[eventTransmissionHistoryIndex]);
eventTransmissionHistory[eventTransmissionHistoryIndex] = 0; // Prevent trying to remove the same events again
eventsQueueIndexAtLastTransmission = eventsQueueIndex;
networkedData = new byte[0];
// If there was a full sync in the queue, it has now been transmitted at least once
hasFullSyncReady = false;
}
#endregion
#region Receiver
@@ -382,20 +458,13 @@ namespace Marro.PacManUdon
return; // Nothing to store
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Received {networkedData.Length} bytes!\nBytes received:\n{BytesToString(networkedData)}");
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Received {networkedData.Length} bytes!\nBytes received:\n{ArrayToString(networkedData)}");
var length = networkedData.Length;
int index = 0;
int eventSize = 0; // Store event size here so we can increment the index no matter how we increment the loop
while (true)
while ((index += eventSize) < length)
{
index += eventSize;
if (index >= length)
{
break;
}
if (length - index < HeaderLength)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) {nameof(StoreIncomingData)}: Remaining data in networkedData is not long enough to form a complete event! remaining: {length - index}.");
@@ -421,38 +490,39 @@ namespace Marro.PacManUdon
var @event = GetArrayPart(networkedData, index, eventSize);
var eventType = GetEventTypeFromHeader(@event);
var timestamp = GetTimestampFromHeader(@event);
var eventId = GetEventIdFromHeader(@event);
if (Synced || fullSyncInQueue)
if (Synced || hasFullSyncReady)
{
if (timestamp == lastEventTimestamp
&& eventId == lastEventId)
if (eventId != GetNextEventId(lastEventId))
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Duplicate message of type {eventType}, timestamp: {timestamp}, messageId: {eventId}.");
if (index + eventSize >= length // If this is the last event of the batch
&& eventId != lastEventId) // Unless the eventId is the same, then this is probably just a duplicate
{
// The last event of the batch has to be synced up with our current event id count, else we've missed an event
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) EventIds were not sequential! Did we miss a serialization? Timestamp: {timestamp}, eventId: {eventId}, lastEventId: {lastEventId}.");
HandleError(false);
return;
}
// We've likely already processed this event, ignore it
continue;
}
if (eventId != GetNextEventId(lastEventId))
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) EventIds were not sequential! Did we miss a serialization? Timestamp: {timestamp}, eventId: {eventId}, lastEventId: {lastEventId}.");
HandleError(false);
return;
}
QueueEventInBuffer(@event);
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)} Queued event with id {eventId}");
}
else
{
// If we're not yet synced, we only care about full sync events.
if (eventType == NetworkEventType.FullSync)
if (IsFullSync(GetEventTypeFromHeader(@event)))
{
QueueFullSyncInBuffer(@event); // Immediately process full sync
QueueFullSyncForReplay(@event); // Immediately process full sync
}
}
lastEventTimestamp = timestamp;
lastEventId = eventId;
}
@@ -462,19 +532,16 @@ namespace Marro.PacManUdon
}
}
private void QueueFullSyncInBuffer(byte[] @event)
private void QueueFullSyncForReplay(byte[] @event)
{
// Intentionally not doing a buffer size check here, since this is not appended to the buffer
// (and there is no good way to continue if this event is too large)
// Clear buffer and put the full sync into it
ClearBuffer();
QueueEventInBuffer(@event);
// Set this event to play after the default delay
nextEventTime = internalTime + Delay;
nextEventTime = internalTime + Delay;
fullSyncInQueue = true;
hasFullSyncReady = true;
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Queued full sync in buffer, should execute at {nextEventTime}.");
}
@@ -483,22 +550,30 @@ namespace Marro.PacManUdon
{
IsEventUpdate = true;
while (bufferIndex != 0 && nextEventTime <= internalTime)
while (eventsQueueIndex > 0 && nextEventTime <= internalTime)
{
PerformEvent(buffer[0]);
var success = PerformEvent(eventsQueue[0]);
if (!success)
{
return;
}
DequeueEventsFromBuffer(1);
UpdateNextEventTime();
}
}
private void PerformEvent(byte[] @event)
private bool PerformEvent(byte[] @event)
{
var timestamp = GetTimestampFromHeader(@event);
var eventType = GetEventTypeFromHeader(@event);
if (eventType == NetworkEventType.FullSync)
var isFullSync = IsFullSync(eventType);
if (!Synced || eventType == NetworkEventType.FullSyncForced)
{
SyncToTimestamp(timestamp, GetEventIdFromHeader(@event));
SyncToTimestamp(timestamp);
}
var index = (int)HeaderLength; // Skip header
@@ -518,7 +593,7 @@ namespace Marro.PacManUdon
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Malformed data reported by {obj.name} during event type {eventType}!");
HandleError(true);
return;
return false;
}
}
@@ -527,49 +602,69 @@ namespace Marro.PacManUdon
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Amount of data read does not match event size! Expected {eventSize}, read {index}.");
HandleError(true);
return;
return false;
}
if (!Synced && eventType == NetworkEventType.FullSync)
if (!Synced && isFullSync)
{
fullSyncInQueue = false;
hasFullSyncReady = false;
Synced = true;
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Processed incoming event! Total {index} bytes.");
retriesWithoutSuccess = 0; // We had success!
return true;
}
public override void OnDeserialization()
{
if (!Ready || IsOwner)
{
return;
}
StoreIncomingData();
}
#endregion
#region Buffer
private void ClearBuffer()
{
buffer = new byte[BufferMaxTotalEvents][];
bufferIndex = 0;
eventsQueue = new byte[BufferMaxTotalEvents][];
eventsQueueIndex = 0;
eventTransmissionHistory = new int[MaxEventSendTries];
eventTransmissionHistoryIndex = 0;
eventsQueueIndexAtLastTransmission = 0;
lastEventId = 0;
}
private void DequeueEventsFromBuffer(int eventCount)
{
var oldBuffer = buffer;
bufferIndex -= eventCount;
buffer = new byte[BufferMaxTotalEvents][];
Array.Copy(oldBuffer, eventCount, buffer, 0, bufferIndex);
if (eventCount > eventsQueueIndex) // Never remove more events than are in the queue
{
eventCount = eventsQueueIndex;
}
var oldBuffer = eventsQueue;
eventsQueueIndex -= eventCount;
eventsQueue = new byte[BufferMaxTotalEvents][];
Array.Copy(oldBuffer, eventCount, eventsQueue, 0, eventsQueueIndex);
}
private bool QueueEventInBuffer(byte[] @event)
{
if (bufferIndex >= BufferMaxTotalEvents)
if (eventsQueueIndex >= BufferMaxTotalEvents)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Buffer not large enough to store event! Maximum event count: {BufferMaxTotalEvents}.");
HandleError(true);
return false;
}
buffer[bufferIndex++] = @event;
eventsQueue[eventsQueueIndex++] = @event;
return true;
}
#endregion
#region Time
@@ -586,7 +681,7 @@ namespace Marro.PacManUdon
SyncedTime = newTime;
}
private void SyncToTimestamp(float timestamp, byte eventId)
private void SyncToTimestamp(float timestamp)
{
var oldOffset = offsetTime;
offsetTime = Time.fixedTime - timestamp;
@@ -596,20 +691,17 @@ namespace Marro.PacManUdon
SyncedTime -= delta;
nextEventTime -= delta;
lastEventTimestamp = timestamp;
lastEventId = eventId;
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Synced to timestamp {timestamp}, current time is {Time.fixedTime}, offsetTime is now {offsetTime}, internalTime is now {internalTime}, SyncedTime is now {SyncedTime}, nextEventTime is now {nextEventTime}");
}
private void UpdateNextEventTime()
{
if (bufferIndex == 0)
if (eventsQueueIndex == 0)
{
return;
}
var nextEventTime = GetTimestampFromHeader(buffer[0]);
var nextEventTime = GetTimestampFromHeader(eventsQueue[0]);
if (nextEventTime >= this.nextEventTime)
{
this.nextEventTime = nextEventTime;
@@ -636,6 +728,9 @@ namespace Marro.PacManUdon
return currentEventId;
}
private static bool IsFullSync(NetworkEventType eventType)
=> eventType == NetworkEventType.FullSync || eventType == NetworkEventType.FullSyncForced;
private static ushort GetEventSizeFromHeader(byte[] @event, int eventIndex = 0)
=> BitConverter.ToUInt16(@event, eventIndex + HeaderEventSizeIndex);
@@ -659,77 +754,28 @@ namespace Marro.PacManUdon
SetOwner(newOwner == Networking.LocalPlayer);
}
private int indexAtLastSerialization = 0;
public override void OnPreSerialization()
{
if (!Ready)
{
return;
}
if (IsOwner)
{
if (buffer == null || bufferIndex == 0)
{
return;
}
networkedData = Flatten(buffer, 0, bufferIndex);
indexAtLastSerialization = bufferIndex;
}
else
{
networkedData = new byte[0]; // Prevent exception loop in VRChat SDK
}
}
public override void OnPostSerialization(SerializationResult result)
{
if (!Ready)
{
return;
}
if (!result.success)
{
Debug.LogWarning($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serialization failed! Tried to send {result.byteCount} bytes.");
return;
}
if (!IsOwner || networkedData.Length == 0)
{
return;
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Serialized with {networkedData.Length} bytes!\nBytes sent:\n{BytesToString(networkedData)}");
// Remove all transferred data from the buffer, leaving data that came in after serialization
DequeueEventsFromBuffer(indexAtLastSerialization);
networkedData = new byte[0];
}
public override void OnDeserialization()
{
if (!Ready || IsOwner)
{
return;
}
StoreIncomingData();
}
#endregion
#region Utils
public string BytesToString(byte[] bytes)
public string ArrayToString(byte[] bytes)
{
var sb = new StringBuilder("new byte[] { ");
var sb = new StringBuilder("[ ");
foreach (var b in bytes)
{
sb.Append(b + ", ");
sb.Append(b + " ");
}
sb.Append("}");
sb.Append("]");
return sb.ToString();
}
public string ArrayToString(int[] bytes)
{
var sb = new StringBuilder("[ ");
foreach (var b in bytes)
{
sb.Append(b + " ");
}
sb.Append("]");
return sb.ToString();
}
@@ -774,7 +820,7 @@ namespace Marro.PacManUdon
#region Debug
public void SimulateSyncToTimestamp(float timestamp)
{
SyncToTimestamp(timestamp, 0);
SyncToTimestamp(timestamp);
}
public void WriteDebugOutput(TMP_InputField debugOutput)
@@ -783,12 +829,15 @@ namespace Marro.PacManUdon
$"IsOwner: {IsOwner}\n" +
$"Ready: {Ready}\n" +
$"Synced: {Synced}\n" +
$"fullSyncInQueue: {fullSyncInQueue}\n" +
$"hasFullSyncReady: {hasFullSyncReady}\n" +
$"lastEventId: {lastEventId}" +
$"Time.fixedTime: {Time.fixedTime}\n" +
$"offsetTime: {offsetTime}\n" +
$"internalTime: {internalTime}\n" +
$"SyncedTime: {SyncedTime}\n" +
$"Dt: {Dt}\n" +
$"BufferIndex: {eventsQueueIndex}\n" +
$"BufferIndexHistory: {ArrayToString(eventTransmissionHistory)}\n" +
$"\n";
}