UnitySendMessage not working on iOS

I tried to send some data using UnitySendMessage in the iOS plugin, but it looks like it is not doing anything, I do not see any errors and answers. I checked the function where UnitySendMessage is located and I am 100% sure that it starts.

- (void) callback{
NSLog(@"UNITY test callback"); 
UnitySendMessage("PluginTest", "listener", "test callback");
}

In the scene, I have a gameObject called PluginTest with the pluginListener component that contains the method:

public void listener(string parameter)
{
    print(parameter);
}

I also added this line to UnityAppController.mm, which was recommended to be added to the message:

extern void UnitySendMessage(const char *, const char *, const char *);

I have no idea what I'm doing wrong, unitySendMessage seems like it should work without much effort. Any help would be appreciated

+4
source share

Source: https://habr.com/ru/post/1656193/


All Articles