x


Harnessing Platform specific APIs

Unity is a powerful and impressive tool. However I may be moving to MonoGame because Unity abstracts away (Advantage for some) the underlying platform and its APIs (Android, iPhone). I am aware of plugins, but they seem difficult to write and use. In addition someone using Unity probably knows C#/Boo and not Java and Objective C. By way of example objectives can someone explain how to overcome these obstacles. These examples would apply to other platforms as well.

1) I want my Android Unity app to have a "Broadcast Receiver" to listen to the "Intents" (ie. "Battery is Low"). Then I want my Unity character to say "Better Plug in your phone".

2) I would like to use the Androids speech recognition (http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition.html) to accurately decode the users speech.

As near as I can tell I would have to learn/write Java (Android)/Objective-C (iPhone). Then I would have to buy Unity Pro and wrap my Java/Objective-C calls in "C". Then I need to wrap the "C" function in C#, which loads the proper dll based upon platform.

Alternatively in MonoGame, I would call existing C# APIs which wrap Java/Objective-C APIs to create my application.

Finally, I would like to support Windows Phone platform and XBOX Indie development. From what I read this will probably never happen.

Thanks,

more ▼

asked May 15 '12 at 09:53 PM

aidesigner gravatar image

aidesigner
-5 1 2 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

I don't have much experience with Android / mobile, but as far as i know plugins can also be used with the indy version of Unity (note: just on mobile, not standalone).

If you have a managed code (C# / CIL) assembly it can be used in any Unity build also in the indy version. Mixed code assemblies can't be used in the webplayer of course, but all other platforms shouldn't be a problem. I think as long as you have a managed code wrapper assembly and all dependencies as native code it should work.

It's of course up to you to decide which engine you want to use. Unity3D is mainly a game engine, so it can't provide every possible interface. With plugins basically everything is possible, maybe there are other engines out there that match your needs better. I think you have to evaluate the whole thing a bit more.

Hopefully you get a better feedback from the Android-experts here ;)

edit: Don't forget to checkout the assetstore. I'm pretty sure most iPhone and Android apis / features has already been wrapped by other peoples.

more ▼

answered May 15 '12 at 10:05 PM

Bunny83 gravatar image

Bunny83
45.3k 11 49 207

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2474
x1999

asked: May 15 '12 at 09:53 PM

Seen: 465 times

Last Updated: May 15 '12 at 10:08 PM