Apr 13th, 2021
Never
NSString. aString = NSString alloc initWithString: @'a string'; UnitySendMessage('MyObject', 'Method', aString UTF8String); But I am wondering how the memory allocation works across the message passing, I guess I have to do allocation (most examples do), but is the UnitySendMessage synchronous. UnityPlayer.UnitySendMessage is a void function and does not return a value. Take a look at the UnitySendMessageExtension function implementation below. It is similar to turnipinindia's answer but it returns a value. It only returns a string so you have to convert that string to.
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
- if(value.startsWith('dm;')){
- // IT'S A DIRECT MESSAGE
- // Recording is started
- setRecording(record)
- }
- val recordingData = Gson().fromJson(recordingJson, RecordingVideocall::class.java)
- viewModel.registrationEnabled=when(recordingData.action){
- sendPrivateMessage('recordStarted')
- RecordingVideocall.ACTION_STOP->{
- }
- }
- UnityPlayer.UnitySendMessage(
- 'NotifyRecording',
- }
- privatefun sendPrivateMessage(message:String){
- UnityPlayer.UnitySendMessage(
- )
RAW Paste Data