- Home /
Will Unity 4.0 support sending complex data from Android or iOS to the Unity scripts?
Im trying to develop a plugin for Unity starting with the Android side of things. I have found the AndroidJavaClass and AndroidJavaObject to be very helpful, but I am having problems when i try to send information to the Unity Scripts that is coming from a call-back in the Android Java code. I have found this line of code to be sufficient for sending Strings:
UnityPlayer.UnitySendMessage("UnityObject", "MethodName", "Message");
but i am unable to find any way to send the complex information to Unity. This is a performance sensitive operation and needs the information to be sent to the scripts.
I have read elsewhere that this is just not possible in Unity 3.x.x, so I am hoping that this will be improved inside Unity 4.x.x
Does anyone have any information about this or if there is any work-around that i could use?
Answer by FatWednesday · Sep 07, 2012 at 10:08 PM
not sure what will happen with UnitySendMessage. but with a bit of reading and work, it is possible to ignore UnitySendMessage all together and just make calls to the functions in your scripts yourself (meaning you can send all sorts across).
I had to do this for a plugin i wrote for iOS before, this page walks you through how to go about sorting it all out. hope its of use to you.
http://www.tinytimgames.com/2010/01/10/the-unityobjective-c-divide/
I am working with @luke5542 on this project. We are developing an android app, correct me if I am wrong, but it is my understanding that we would not be able to use NSString *assemblyPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Data/Assembly - CSharp.dll"] to find the assembly path. Do you know of an alternative way to find the path using C or Java?
Ah with android I'm afraid I can't really comment, not done any unity + android work yet. But i've no doubt there will be android equivalents. you'll just have to do some googling for them.
Your answer
Follow this Question
Related Questions
How do I make an Android plugin for unity? 0 Answers
Getting byte[] or ByteBuffer[] from native Java 1 Answer
why unity not resolving aar and jar files 0 Answers
Xamarin Android Plugins for Unity 0 Answers