Necesito enviar datos desde c# a java y viceversa. Utilizo la función android java object. Ya se identificó que el momento donde se detiene es cuando se realiza la llamada a java con el .Call()
.
Clase java
package cicese.mooding.brain.data.interaction;
public class Communication
{
private int id;
private String type;
private String[] value;
public Communication() {}
public int GetID()
{
return id;
}
public void SetID(int value)
{
id = value;
}
public String GetType()
{
return type;
}
public void SetType(String value)
{
type = value;
}
public String[] GetValue()
{
return value;
}
public void SetValue(String[] value)
{
this.value = value;
}
}
Codigo c# en unity (queremos llamar a la función SetValue
)
public void Response()
{
AndroidJavaObject manager = new AndroidJavaObject("cicese.mooding.brain.BrainManager");
AndroidJavaObject response = new AndroidJavaObject("cicese.mooding.brain.data.interaction.Communication");
string stringParameter = EventSystem.current.currentSelectedGameObject.name;
object[] args = new object[] { stringParameter };
response.Call("SetValue",args);
args = new object[] { response };
AndroidJavaObject data = manager.Call<AndroidJavaObject>("receiveDataFromGUI", args);
inter = Interaction.AndroidJavaToCSharp(data);
}