azesmway / react-native-unity-play

Play an unity view in react native
MIT License
40 stars 16 forks source link

PostMessage in iOS #22

Open iamjessroman opened 2 years ago

iamjessroman commented 2 years ago

Hi!,

I'm using the repository and I need to send a message an object to Unity from React Native on iOS, I have version 1.6.0 of the repository.

I was seeing in the commits "Send message to Unity (ios)" because the node_module does not have those lines of code, I have replicated that commit but now I have this error:

Exception 'postMessage: is not a recognized Objective-C method.' was thrown while invoking postMessage on target RNUnity with params ( "GameObject/Cube", toggleRotate, message )

I hope your help, I haven't been able to do it yet.

alexeyzolotaryov commented 2 years ago

Hi

In the current version, I did not use the mechanism for sending messages to Unity. Maybe in the next versions

iamjessroman commented 2 years ago

And how much would it cost to add this functionality? I want it urgently, I could pay by paypal. I just need to send a JSON type object to Unity from React Native and vice versa.

alexeyzolotaryov commented 2 years ago

If you need it so urgently, then you can try this package https://github.com/asmadsen/react-native-unity-view this package - it has sending and receiving messages

iamjessroman commented 2 years ago

I have tried those plugins and none work except this one.

alexeyzolotaryov commented 2 years ago

I can, tomorrow / the day after tomorrow, request a consultation on integrating calls in a new Unity and then I can add them to the plugin, but this will not be earlier than the beginning of next week

iamjessroman commented 2 years ago

Perfect :)

azesmway commented 2 years ago

Hi!,

I'm using the repository and I need to send a message an object to Unity from React Native on iOS, I have version 1.6.0 of the repository.

I was seeing in the commits "Send message to Unity (ios)" because the node_module does not have those lines of code, I have replicated that commit but now I have this error:

Exception 'postMessage: is not a recognized Objective-C method.' was thrown while invoking postMessage on target RNUnity with params ( "GameObject/Cube", toggleRotate, message )

I hope your help, I haven't been able to do it yet.

Hi I made a new project to replace the current one - there is now only for IOS. Android will do later https://github.com/azesmway/react-native-unity-play-ts

iamjessroman commented 2 years ago

Hi!

Thank you very much seriously, at this moment I will do tests with the project that I have.

StarLederer commented 2 years ago

There are classes that seem to be unused the RNBridge.cs and UnityReactActivity.java. It looks like a unity - react native communication implementation. Is it unfinished? Asking mostly out of curiosity since I want to understand the source code

azesmway commented 2 years ago

New version plugin here https://github.com/azesmway/react-native-unity