Skip to content

Commit

Permalink
Attempt to workaround a script execution order bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JLChnToZ committed Jan 30, 2024
1 parent 3a5679f commit 0950f95
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 28 deletions.
105 changes: 77 additions & 28 deletions Packages/idv.jlchntoz.vvmw/Runtime/VVMW/Core.asset
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 61
Data: 62
- Name:
Entry: 7
Data:
Expand Down Expand Up @@ -3249,10 +3249,59 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: url
Data: isInit
- Name: $v
Entry: 7
Data: 184|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: isInit
- Name: <UserType>k__BackingField
Entry: 9
Data: 46
- Name: <SystemType>k__BackingField
Entry: 9
Data: 46
- 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: 185|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: url
- Name: $v
Entry: 7
Data: 186|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: url
Expand All @@ -3276,14 +3325,14 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 185|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 187|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 186|System.NonSerializedAttribute, mscorlib
Data: 188|System.NonSerializedAttribute, mscorlib
- Name:
Entry: 8
Data:
Expand All @@ -3307,13 +3356,13 @@ MonoBehaviour:
Data: author
- Name: $v
Entry: 7
Data: 187|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 189|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: author
- Name: <UserType>k__BackingField
Entry: 7
Data: 188|System.RuntimeType, mscorlib
Data: 190|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String, mscorlib
Expand All @@ -3322,7 +3371,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 188
Data: 190
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -3337,20 +3386,20 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 189|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 191|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 190|System.NonSerializedAttribute, mscorlib
Data: 192|System.NonSerializedAttribute, mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 191|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 193|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
Expand All @@ -3374,16 +3423,16 @@ MonoBehaviour:
Data: title
- Name: $v
Entry: 7
Data: 192|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 194|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: title
- Name: <UserType>k__BackingField
Entry: 9
Data: 188
Data: 190
- Name: <SystemType>k__BackingField
Entry: 9
Data: 188
Data: 190
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -3398,20 +3447,20 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 193|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 195|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 194|System.NonSerializedAttribute, mscorlib
Data: 196|System.NonSerializedAttribute, mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 195|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 197|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
Expand All @@ -3435,16 +3484,16 @@ MonoBehaviour:
Data: viewCount
- Name: $v
Entry: 7
Data: 196|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 198|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: viewCount
- Name: <UserType>k__BackingField
Entry: 9
Data: 188
Data: 190
- Name: <SystemType>k__BackingField
Entry: 9
Data: 188
Data: 190
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -3459,20 +3508,20 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 197|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 199|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 198|System.NonSerializedAttribute, mscorlib
Data: 200|System.NonSerializedAttribute, mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 199|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 201|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
Expand All @@ -3496,16 +3545,16 @@ MonoBehaviour:
Data: description
- Name: $v
Entry: 7
Data: 200|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 202|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: description
- Name: <UserType>k__BackingField
Entry: 9
Data: 188
Data: 190
- Name: <SystemType>k__BackingField
Entry: 9
Data: 188
Data: 190
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -3520,20 +3569,20 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 201|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
Data: 203|System.Collections.Generic.List`1[[System.Attribute, mscorlib]],
mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 202|System.NonSerializedAttribute, mscorlib
Data: 204|System.NonSerializedAttribute, mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 203|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 205|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
Expand Down
2 changes: 2 additions & 0 deletions Packages/idv.jlchntoz.vvmw/Runtime/VVMW/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class Core : UdonSharpEventSender {
MaterialPropertyBlock screenTargetPropertyBlock;
AudioSource assignedAudioSource;
bool isRealtimeGIUpdaterRunning;
internal bool isInit;

// Yttl Receivers
[NonSerialized] public VRCUrl url;
Expand Down Expand Up @@ -349,6 +350,7 @@ void Start() {
screenTargetPropertyBlock = new MaterialPropertyBlock();
UpdateVolume();
if (!synced || Networking.IsOwner(gameObject)) SendCustomEventDelayedSeconds(nameof(_PlayDefaultUrl), autoPlayDelay);
isInit = true;
}

public void _PlayDefaultUrl() {
Expand Down
5 changes: 5 additions & 0 deletions Packages/idv.jlchntoz.vvmw/Runtime/VVMW/FrontendHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ public void NoRepeat() {
}

void Start() {
if (!core.isInit) {
Debug.LogWarning("[VVMW] It seems FrontendHandler initialized before Core, and this should not happened (Hence the script execution order).\nWaiting for Core to initialize...");
SendCustomEventDelayedFrames("_start", 0);
return;
}
synced = core.IsSynced;
if (!synced || Networking.IsOwner(gameObject)) {
if (core.Loop) localFlags |= REPEAT_ONE;
Expand Down

0 comments on commit 0950f95

Please sign in to comment.