vrchat-community / UdonSharp

A compiler for compiling C# to Udon assembly
https://udonsharp.docs.vrchat.com
MIT License
463 stars 50 forks source link

How to get/set `UdonBehaviour.InteractionText` on `this`? #41

Closed JanSharp closed 2 years ago

JanSharp commented 2 years ago

InteractionText does not appear to be available on UdonSharpBehaviour. You can, however, get/set it on an UdonBehaviour instance and it compiles and works as expected (as in reading the right value and displaing the given value).

I'd have expected InteractionText to be on UdonSharpBehaviour, however I would not be surprised if you had to get the UdonBehaviour of this to get access to it, but if that's the case, well, I don't know how to get said UdonBehaviour outside of using GetComponent which is not only cumbersome and has the issue with multiple UdonBehaviours on one GameObject (well, maybe. Not sure how InteractionText is implemented in this regard but it's besides the point). Plus it would be weird if that was the intentional way to get/set InteractionText on this.

Ultimately I'm asking if I'm missing something or if InteractionText was simply missed and should be added to UdonSharpBehaviour.

oOtroyOo commented 2 years ago

Me too. Btw , ((UdonBehaviour) GetComponent(typeof(UdonBehaviour))).InteractionText can do it. but not sure wich one in the multiple components is correct

MerlinVR commented 2 years ago

The InteractionText property is supported on U# behaviours in 1.0.