Bounds.IntersectRay 2nd argument distance not working

I can’t seem to get the 2nd argument working for the method Bounds.IntersectRay. The 2nd argument should return me the distance to the bounding box. But i just can’t get it to work.
The editor is throwing an exception about “MissingMethodException: Method not found: 'UnityEngine.Bounds.IntersectRay”

The documentation is saying there is an overloaded method of the intersectRay shown below:
Bounds.IntersectRay (ray : Ray, out distance : float)

But when i add the 2nd argument the editor is throwing the exception. When only passing 1 parameter the function is working as expected.

Are overloaded functions not supported in javascript or do i need to add something special. I don’t get it :frowning:

Are you calling it as Bounds.IntersectRay(ray, out distanceVar)? I don’t use javascript so don’t know if the out keyword is necessary for it, but it is in C#.

Javascript would be pretty useless if they weren’t. :wink: However, this particular case seems to be an exception, since it works as expected in C#. (Rather bizarre as I don’t think I’ve ever seen that happen before.) I’d suggest using the bug reporter and submitting it as a bug.

As for the “out” keyword, no, you don’t use that in Javascript.

–Eric

Yeah i am using it like this

var distance: float;
if ( element.bounds.IntersectRay( ray, distance ) )
{
//do something
}

If you confirm it works likes expected in c# then it could be a bug in the function definition list for js variant.

I’ll go submit it and continue in C#

Thanks