Udon Bugs & Feature Requests

Post about current Udon bugs and Udon Feature Requests.
One item per post!
Non-constructive and off-topic posts will be moved or deleted.
Expose Graphics.SetRandomWriteTarget
Note: This request is an excerpt of this document which contains some additional context and suggestions for a implementation. With the introduction of VRCGraphics.Blit and asynchronous readback feature, we are closer than ever before to having compute-shader-like capabilities in VRChat. However, we are still missing a critical component: Random writes! Random writes are the ability to write to any location in a block of memory, represented as an unordered access view (UAV) - in our case, these UAVs concretely are just RenderTextures. Random writes are hugely useful for making compute-shader-like code performant, and for many of the things that people tend to use real compute shaders for, they are downright required. This is due in part to the fact that they enable the use of atomic operations (example), which open up the doors to a bunch of algorithms that are infeasible or very tricky to implement without. We could get very close to approximating compute shaders today with the addition of one single piece of API: Graphics.SetRandomWriteTarget . With this API, you can do random writes in fragment shaders, which brings them much closer to compute shaders (see the initial link for example code). Here are some examples of possible use cases: Persistent data storage in a shader without jank. No need for GrabPass abuse, Custom Render Textures, or Camera loops. Just bind a RenderTexture and you are good to go. Communication between shaders without jank. Simply bind your render texture, and any fragment shader can now access it with both read and write access. Custom realtime GI systems. I implemented a system that places and integrates light probes dynamically based on camera depth using this piece of API. Better fluid simulations. In general, pretty much any kind of shader-based simulation can benefit from this. Either by being made simpler to implement, faster, or becoming feasible in the first place. Potentially speedup for AudioLink's DFT algorithm? Fast reduce-style operations such as summing or maxing over a domain. GPU based sorting.
0
Instantiating a GameObject with an UdonBehaviour attached to it or a child, in OnPlayerJoined, will result in an exception (in Play mode)
Tested this in a fresh project with a blank (and non-blank) UdonBehaviour attached to a GameObject (or a child of it). public override void OnPlayerJoined(VRCPlayerApi player) { Instantiate(TestObject); } The error is: InvalidOperationException: Collection was modified; enumeration operation may not execute. System.Collections.Generic.Dictionary`2+ValueCollection+Enumerator[TKey,TValue].MoveNext () (at <eef08f56e2e042f1b3027eca477293d9>:0) VRC.Udon.UdonManager.RunEvent (System.String eventName, System.ValueTuple`2[System.String,System.Object][] eventParameters) (at ./Packages/com.vrchat.worlds/Runtime/Udon/UdonManager.cs:896) VRC.SDK3.ClientSim.ClientSimUdonManagerEventSender.RunEvent (System.String eventName, System.ValueTuple`2[System.String,System.Object][] programVariables) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/System/ClientSimUdonManagerEventSender.cs:16) VRC.SDK3.ClientSim.ClientSimUdonManager.OnPlayerJoined (VRC.SDK3.ClientSim.ClientSimOnPlayerJoinedEvent joinEvent) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/System/ClientSimUdonManager.cs:106) VRC.SDK3.ClientSim.ClientSimEventDispatcher.SendEvent[T] (T clientSimEvent) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/Events/ClientSimEventDispatcher.cs:62) VRC.SDK3.ClientSim.ClientSimPlayerManager.DispatchPlayerJoinedEvent (VRC.SDKBase.VRCPlayerApi player) (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/System/ClientSimPlayerManager.cs:117) VRC.SDK3.ClientSim.ClientSimPlayerManager.OnClientSimReady () (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/System/ClientSimPlayerManager.cs:109) VRC.SDK3.ClientSim.ClientSimMain+<InitializeClientSim>d__40.MoveNext () (at ./Packages/com.vrchat.worlds/Integrations/ClientSim/Runtime/System/ClientSimMain.cs:354) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <b41119cc6741409ea29f63c7f98de938>:0)
1
Load More