SDK Bug & Feature Requests

Please check out the following rules and use the provided template when posting a bug report! Off-topic posts will be deleted.http://bit.ly/vrchat-bug-reports
[3.10.2,3.10.3] VRCSceneTemplateInitializer does not create sample scene if UDON preprocessor symbol is defined at first launch since VRCSDK 3.10.2.
VRCSceneTemplateInitializer does not create the default sample scene when the UDON preprocessor symbol is already defined on the first launch. Steps to reproduce Prepare a VRChat Worlds template with the UDON preprocessor symbol already defined. The original report used a project template generated by ALCOM 1.1.5 or earlier. (We added a workaround in 1.1.6.) However, the issue can also be reproduced by modifying a VCC template to include the UDON preprocessor symbol in ProjectSettings.asset . For reference, ALCOM's Worlds template included the UDON preprocessor symbol to reduce the initial Unity launch time by avoiding recompilation of most assemblies. Launch Unity. VRCSceneTemplateInitializer should create the default scene, but it does not. Cause of the bug This bug is triggered by the combination of the following conditions: UdonSharpDataLocator does not exist in the project. This causes Assets/UdonSharp/UtilityScripts to be generated during the first assembly load. The UDON preprocessor symbol is already defined before the first compilation. This causes [InitializeOnLoad] in VRCSceneTemplateInitializer to run during the first assembly load. The sequence of events is as follows: Unity compiles scripts normally. Unity calls the static constructor of VRCSceneTemplateInitializer because of [InitializeOnLoad] . VRCSceneTemplateInitializer checks SessionState.GetBool(HasRunStateKey, false) , which is false , so it sets HasRunStateKey to true and registers an EditorApplication.delayCall to generate VRCDefaultWorldScene . Unity calls some [InitializeOnLoad] methods from UdonSharp, and UdonSharp generates Assets/UdonSharp/UtilityScripts . Unity recompiles Assembly-CSharp and reloads the domain. Note that the registered delayCall is never executed before this reload. Unity calls the static constructor of VRCSceneTemplateInitializer again because of [InitializeOnLoad] . This time, SessionState.GetBool(HasRunStateKey, false) returns true , so nothing happens. As a result, the logic that generates VRCDefaultWorldScene is never executed. (The order of steps 2 and 3 may differ, but the result is the same.) For comparison, the following sequence does not cause the bug when the UDON symbol is not initially defined: Unity compiles scripts normally, but the VRC.SDK3.Editor assembly containing VRCSceneTemplateInitializer is not compiled because of "defineConstraints": ["UDON"] . Unity calls some [InitializeOnLoad] methods from UdonSharp, and UdonSharp generates Assets/UdonSharp/UtilityScripts . EnvConfig.cs checks for VRC.Udon.UdonBehaviour and adds the UDON preprocessor symbol. Unity recompiles all assemblies and reloads the domain. Unity calls the static constructor of VRCSceneTemplateInitializer because of [InitializeOnLoad] . SessionState.GetBool(HasRunStateKey, false) returns false , so it sets HasRunStateKey to true and registers an EditorApplication.delayCall that generates VRCDefaultWorldScene . Unity executes the EditorApplication.delayCall , and VRCDefaultWorldScene is generated correctly. Suggested fix The issue is that HasRunStateKey is set to true before the EditorApplication.delayCall is actually executed. I believe moving the HasRunStateKey assignment into the EditorApplication.delayCall lambda would fix the issue.
13
·
Bug Report
·
available in future release
Race condition in ContactManager often crashes contacts in the editor
If a contact is enabled in the editor play mode while contacts are being processed in their background thread, the addition of that contact crashes with the following stack trace, and fails to process from that point on. This issue is new in VRCSDK 3.7.3 and still exists in 3.7.4. InvalidOperationException: The previously scheduled job ContactManager:UpdateReceivers writes to the Unity.Collections.NativeArray`1[VRC.Dynamics.ContactManager+ReceiverData] UpdateReceivers.receivers. You must call JobHandle.Complete() on the job ContactManager:UpdateReceivers, before you can read from the Unity.Collections.NativeArray`1[VRC.Dynamics.ContactManager+ReceiverData] safely. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0) Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0) Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0) Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0) VRC.Dynamics.ContactManager.FindAvailableId () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) VRC.Dynamics.ContactManager.AddContact (VRC.Dynamics.ContactBase contact) (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) VRC.Dynamics.ContactBase.Start () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) VRC.Dynamics.ContactReceiver.Start () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) And then every frame after that (because the contact was not added to the manager properly): IndexOutOfRangeException: Index 65535 is out of range of '4096' Length. Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0) Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0) Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0) VRC.Dynamics.ContactReceiver.UpdateContact () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) VRC.Dynamics.ContactManager.HandleDynamicsFrameComplete () (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) VRC.Dynamics.VRCAvatarDynamicsScheduler.FinalizeJob (System.Boolean force) (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) VRC.Dynamics.VRCAvatarDynamicsScheduler.OnCameraPreCull (UnityEngine.Camera cam) (at <18f19c27e14b4ae6a2e430e7e9917e85>:0) UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) (at <cb81df0c49c643b1a04d9fc6ccca2433>:0)
3
·
available in future release
Load More