- Home /
Sneak in UIView
Does anyone know how to sneak a UIView into a Unity game through XCode and use it to launch scenes?
slightly related topic, using xcode in unity: http://forum.unity3d.com/threads/57750-make-a-native-call-to-output-the-compass-value
Answer by Mantas-Puida · May 24, 2010 at 10:17 AM
This is possible, but it isn't an easy task. You can achieve that with use of native plugin (Unity iPhone Advanced feature):
- Expose your native C/C++ function as native plugin. (Check this example : http://unity3d.com/support/resources/files/NativeCodeExample.zip)
- Inside this native function pause unity player (call UnityPause(true)).
- Create and display UIView.
- Gather user input results from UIView, dispose UIView.
- Unpause unity player (call UnityPause(false)).
- Send gathered user input to the scripts (call UnitySendMessage(...)).
Another question, I also want to pass some values to the unity when I launch it from the UIView. Any ideas on that?
UnitySend$$anonymous$$essage 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.
Your answer
Follow this Question
Related Questions
Load a Level on Touch 1 Answer
iPhone loading strategies ? 1 Answer
Number of scenes for iPhone games 1 Answer
Optimize my game? 2 Answers
Dynamically choosing a high resolution texture at runtime on iOS devices 1 Answer