Multiple inputs for a single function argument?

Hey dudes,

I’ve got a function MoveTo().

Ideally I’d like to be able to send it either an explicit Vector3 or a custom Actor class (from which I can derive a Vector3) in order to have my character MoveTo that Vector3 point.

Is it possible to allow a function to receive either a Vector3 or my Actor class as it’s sole argument?

i.e. be able to do

MoveTo ( Vector3.zero );
or
MoveTo ( NPCActor );

Using JS, by the way.

You can write the same function name with different arguments, no problem.

function Foo(var b:Vector3) {}
function Foo(var b:GameObject) {}

Oh right, neat.

Cheers :slight_smile: