Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

User-defined UdonSharpBehaviour-dervied classes break the null-coalescing (??) operator #126

Open
dustuuvr opened this issue Oct 29, 2021 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@dustuuvr
Copy link

Attempting to reference an instance of a user-defined UdonSharpBehaviour-dervied class on the left-hand side of the null-coalescing (??) operator causes a U# compiler error.

Example problematic code:

private KaraokeUiBrowser _uiBrowser = null;
public KaraokeUiBrowser UiBrowser
{ get { return _uiBrowser ?? (_uiBrowser = GetComponentInParent<KaraokeUiBrowser>()); } }

(Where KaraokeUiBrowser is a user-defined subclass of UdonSharpBehaviour)

The above code causes the following error to be thrown upon compilation:
System.ArgumentException: Cannot implicitly convert type 'KaraokeUiBrowser' to 'UdonBehaviour'

This problem appears to only be triggered when the UdonSharpBehaviour subclass is on the left-hand side of the ?? operator, the right-hand side appears to function as expected.

@dustuuvr dustuuvr added the bug Something isn't working label Oct 29, 2021
@MerlinVR MerlinVR added this to the UdonSharp 1.0 milestone Oct 29, 2021
@MerlinVR
Copy link
Owner

Fixed in 1.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants