UdonSharp icon indicating copy to clipboard operation
UdonSharp copied to clipboard

Implement IUdonEventReceiver interface on UdonSharpBehaviour

Open synergiance opened this issue 3 years ago • 2 comments

Feature Description: This one's pretty simple, I want UdonSharpBehaviour to implement the interface IUdonEventReceiver to make it work with the new image downloader class.

Additional context: When trying to pass this into VRCImageDownloader.DownloadImage() I get a compile error. I tried adding IUdonEventReceiver to the list of interfaces to the UdonSharpBehaviour class myself and it required a bunch of internal vrchat jargon we didn't need, but was necessary for the interface to work. As it stands right now, unless using hacky methods, we cannot pass the current behaviour into the DownloadImage() method. As such this may be an upstream problem I'm willing to file a canny for. Either that or I'm just doing it wrong.

synergiance avatar Mar 01 '23 04:03 synergiance

you can cast UdonSharpBehaviour to IUdonEventReceiver directly, with (IUdonEventReceiver)this

Phasedragon avatar Mar 01 '23 04:03 Phasedragon

It's a great workaround, thanks!

That being said, I'd expect to be able to use an UdonSharpBehaviour anywhere an UdonBehaviour is used directly since an UdonSharpBehaviour essentially is an UdonBehaviour. This would be good to note on the documentation. It would also be good to note on the documentation that Material and UdonBehaviour parameters are not optional, unlike what is described with the Udon Graph.

synergiance avatar Mar 01 '23 04:03 synergiance