MerlinVR / USharpVideo

A basic video player made for VRChat using Udon and UdonSharp
MIT License
317 stars 40 forks source link

Fix log spam caused by invalid scripts in build #78

Open Happyrobot33 opened 9 months ago

Happyrobot33 commented 9 months ago

The issue itself

This is an issue with the UI Styler system, that I am also encountering with this asset I maintain that uses a forked version of said UI styler setup. The issue seems to stem from the fact that even though all of the UI Styler scripts ARE excluded from the built version of the world, something about Unity itself still thinks there should be script components there and will spam the log with a bunch of WARNING: The referenced script on this Behaviour {Game Object Name} is missing!. This doesn't actually cause any crashing but makes reading world logs a massive pain as it just turns into a massive wall of text image

Things ive tried

All of these approaches tackle deleting the components from the gameobjects themselves

[OnPostProcessScene]

Removes them in the unity scene upon play mode, but doesnt seem to fix the error in game. I know this works for builds because I have other scripts that run during OnPostProcessScene that edit U# script values and those work fine

Using the SDK callbacks

This technically could work but realistically isnt a option since when these are called, Unity hasnt saved a copy of the scene yet so the edits are applied to the active scene, breaking the UI Styler permanently since the components are deleted