x


Sneak in UIView

Does anyone know how to sneak a UIView into a Unity game through XCode and use it to launch scenes?

more ▼

asked May 03 '10 at 07:31 PM

rd42 gravatar image

rd42
296 30 37 46

Feb 23 '11 at 04:22 PM Cawas
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

This is possible, but it isn't an easy task. You can achieve that with use of native plugin (Unity iPhone Advanced feature):

  1. Expose your native C/C++ function as native plugin. (Check this example : http://unity3d.com/support/resources/files/NativeCodeExample.zip)
  2. Inside this native function pause unity player (call UnityPause(true)).
  3. Create and display UIView.
  4. Gather user input results from UIView, dispose UIView.
  5. Unpause unity player (call UnityPause(false)).
  6. Send gathered user input to the scripts (call UnitySendMessage(...)).
more ▼

answered May 24 '10 at 10:17 AM

Mantas Puida gravatar image

Mantas Puida
871 1 4 10

Awesome thanks.

May 24 '10 at 01:51 PM rd42

Another question, I also want to pass some values to the unity when I launch it from the UIView. Any ideas on that?

Jun 05 '10 at 02:33 PM rd42

UnitySendMessage accepts 1 string parameter that will be passed to your script method. So you can use it to pass some basic info. Another way is to store your native data into some global static native structure: * create native function to access this data, * create C# wrapper for this native function (see native code example), * call this C# wrapper in some your script Awake / Update method.

Jun 09 '10 at 10:38 AM Mantas Puida
(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:

x1999
x110
x4

asked: May 03 '10 at 07:31 PM

Seen: 2234 times

Last Updated: May 25 '10 at 11:33 AM