Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to send message from java to Unity using UnityPlayer.UnitySendMessage

I am trying to create an android plugin in Java. When I am trying to return some message back to Unity using

UnityPlayer.UnitySendMessage("testObject", "testMethod", "sample message");

When running the code from unity,

I get following exception

SendMessage: Object testObject is not found!

I have testObject as game object in my scene.

I am able to figure out what is the issue here.

One other approach I thought can work is if I can use GetComponent<>, but for that I have to pass the gameObject (testObject) to java about which I have no idea.

Can anybody help me in this?

like image 801
Ashwani K Avatar asked Mar 26 '13 11:03

Ashwani K


1 Answers

  1. The name of the GameObject must be "testObject" Check if is true: http://docs.unity3d.com/Documentation/ScriptReference/Object-name.html

  2. You need to describe better. Can be a lot of things

like image 138
Fernando Martínez Avatar answered Oct 15 '22 10:10

Fernando Martínez