Pass a C# integar array to a JS array in unity

Hi,

I want to pass the integar array to a javascript array via a function. How do i go about doing that??

Here’s what i am doing:

Loader.cs

//This function serves as a checkup and returns the required array
public int[] StepData(string stepIdString)
	{
               //populating the array//works fine checked it with debugger

               return stepData;
	}

In my character:

behavior.js  //<- JS not Csharp here

// Something like: var array = StepData(2)

Can someone help me out on this one? I don’t know if this is a re-post, if it is then my apologies… in that case point me out

I don’t need to tell that I am a newbie, because i totally am :wink: and thanks alot in advance!

Hi,

Try this line of code -

var array = new Array (StepData(2));

Where StepData(2) returns C# Array.

You have write the following line of code -

var array = new Array (StepData(2));