I am writing a Plugin for Unity3D in Android Studio (Java) and I want to pass a boolean value as callback to Unity C# variable or function. I need help in this.
On your Java-side:
public static void SendUnityResults()
{
boolean yourBool = false;
UnityPlayer.UnitySendMessage("gameObjectNameThatReceiveTheValue", "CallbackMethodName", String.valueOf(yourBool));
}
On your Unity-side:
Make a GameObject with the name " gameObjectNameThatReceiveTheValue
" and with a public method called " CallbackMethodName
".
Edit: Added Unity-side method
public void CallbackMethodName(string yourStringedBool)
{
bool yourBool = bool.Parse(yourStringedBool);
Debug.Log("Your bool received with value:" + yourBool);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.