sendmessage js to c#

Hello i want to pass a js array like argument to a c# function. Here my code :
Javascript moveScript:

var arr = new Array(); 
var posX=0;
var posY=0;
var posZ=0;
var posTime=3;
arr.push(posX); 
arr.push(posY); 
arr.push(posZ); 
arr.push(posTime); 
print(arr);

SendMessage("moveElement",arr);

C# animateScript :

using UnityEngine;
using System.Collections;


public class animateScript : MonoBehaviour {

	int posX;
	int posY;
	int posZ;
	int posTime;
	void moveElement(int[] arg1){
		//print (arg1);
		posX=arg1[0];
		
		Hashtable props = new Hashtable();
		props.Add("position", new Vector3(posX,posY,posZ));
		props.Add("direction", 2);
		Ani.Mate.To(transform, posTime, props); 
	}
}

I have an error in the console, and i can’t pass my array. What is the problem ? Thanks :slight_smile:

You’re trying to pass Array(), but the function is expecting int[ ], and those are two different things. Also you can’t use Array() in C#. But generally speaking, you’d be better off keeping everything in one language.

–Eric