Udon compilation exception UdonSharp.UdonSharpProgramAsset) is null

In a Quest world 3, testing out Collider trigger to change a gameObject property.
Added Udon graph

image

When I try to test run, Udon compilation fails with error:

[UdonSharp] Source C# script on ToggleArea Udon C# Program Asset (UdonSharp.UdonSharpProgramAsset) is null
UnityEngine.Debug:LogError (object,UnityEngine.Object)
UdonSharp.UdonSharpUtils:LogError (object,UnityEngine.Object) (at Packages/com.vrchat.udonsharp/Editor/UdonSharpUtils.cs:329)
UdonSharp.Compiler.UdonSharpCompilerV1:Compile (UdonSharp.Compiler.UdonSharpCompileOptions) (at Packages/com.vrchat.udonsharp/Editor/Compiler/UdonSharpCompilerV1.cs:285)
UdonSharp.Compiler.UdonSharpCompilerV1:CompileSync (UdonSharp.Compiler.UdonSharpCompileOptions) (at Packages/com.vrchat.udonsharp/Editor/Compiler/UdonSharpCompilerV1.cs:242)
UdonSharpEditor.UdonSharpEditorManager:OnChangePlayMode (UnityEditor.PlayModeStateChange) (at Packages/com.vrchat.udonsharp/Editor/UdonSharpEditorManager.cs:670)
UnityEngine.GUIUtility:ProcessEvent (int,intptr)

replying to me own thread, it looks like this is now working, I am not sure what the root cause must have been

I had the same problem and found how to solve it.
I would leave info about this error for someone who opens this page in the future.

This error means that “Udon C# Program Asset” is missing, so you can solve this by deleting the corrupted asset or setting a script to the asset.

But where is that corrupted asset?
In my case, it is in a directory named “_UdonProgramSources”, and this directory is in a same directory with a scene file having a corrupted U# script component.
Maybe you can find that with clicking U# script’s Program Source.
Click “Sleep Station Udon C# Program Asset” in this screenshot, you will find Program Sources directory in assets window.

ss1

This directory has some Udon Program Asset files.
If you are in a correct Sources directory, you will find an asset which Source Script is None.
Delete that asset or set U# script, this error is banished and you don’t see that anymore.

2 Likes

Thanks for contributing @hiziriAI , much appreciated. This makes sense. Like most people, I tested out a number of assets, some have included scripts, so I ended up having to delete/remove them completely from the project to get this to work.
I just started to experiment in my free spare time and so far it looks as if the easiest solution would be to use the added C# plugin to sadly avoid having to use Udon, a great concept and implementation but at the same time, not so accessible as it was originally intended I believe.
So far, I have only experimented with one piece of C# code to replicate the same trigger and it appears to be easier but then I cannot make any claims, I am a noob, thanks for posting.
I also find it hard to find examples, this Udon graph was copied from a Youtuber, and the examples provided by Vrchat are very limited, I do not quite understand how they intend to increase adoption.

I caused this error by adding a regular unity “script” component to my sphere collider and it created a “SoundSphereTree Udon C# Program Asset.asset” file in this same folder. Since I deleted the component it left that file behind and caused this null object since it’s now “orphaned”. So I just deleted that file and left behind my actual Udon .asset file it compiles correctly now! My udon file is named “SoundSphereTree Udon Graph Program Asset.asset”
deleting that “SoundSphereTree Udon C# Program Asset.asset” one fixed it.