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.
Trying to call
Lengthon a Property that returns an Array of a user-definedUdonSharpBehaviourtype gives a U# compiler errorSystem.Exception: Method <<<TypeNameHere>>>Array.__get_Length__SystemInt32 is not exposed in Udon, even though usingLengthon a regular array of that type works fine.Example code:
In the above code, calling
Test.Lengthwill cause the previously mentioned U# compiler error. Meanwhile, calling_test.Lengthworks as expected.You can actually cache the resulting value of
Testinto another variable and then callLengthon that variable with no issue. for example the following operation is valid:This shows that the issue only arises when calling
Lengthdirectly off of the original property.