从android调用unity

时间:2015-04-07 12:11:26

标签: c# android unity3d

我有一个使用android libarary的统一项目。从我的安卓库我打电话

UnityPlayer.UnitySendMessage("GameObject", "recieve", "Test Message");

附加到GameObject的C#脚本具有方法

public void receive(string message){
        str = "received" + message;
        //do something
    }
但是,似乎当android调用UnityPlayer.UnitySendMessage()时,C#receive()方法不会被调用。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

好像你的方法名称有误(接收):

UnityPlayer.UnitySendMessage("GameObject", "recieve", "Test Message");

而不是:

UnityPlayer.UnitySendMessage("GameObject", "receive", "Test Message");