Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly accessing Length on Array Properties causes U# compiler error #124

Open
dustuuvr opened this issue Oct 5, 2021 · 0 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@dustuuvr
Copy link

dustuuvr commented Oct 5, 2021

Trying to call Length on a Property that returns an Array of a user-defined UdonSharpBehaviour type gives a U# compiler error System.Exception: Method <<<TypeNameHere>>>Array.__get_Length__SystemInt32 is not exposed in Udon, even though using Length on a regular array of that type works fine.

Example code:

CustomUdonSharpBehaviour[] _test;

CustomUdonSharpBehaviour[] Test { get { return _test; } }

In the above code, calling Test.Length will cause the previously mentioned U# compiler error. Meanwhile, calling _test.Length works as expected.

You can actually cache the resulting value of Test into another variable and then call Length on that variable with no issue. for example the following operation is valid:

CustomUdonSharpBehaviour[] x = Test;
Debug.Log(x.Length);

This shows that the issue only arises when calling Length directly off of the original property.

@dustuuvr dustuuvr added the bug Something isn't working label Oct 5, 2021
@MerlinVR MerlinVR added this to the UdonSharp 1.0 milestone Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants