Unity and iOS interaction is much simpler, direct export Xcode project, this everyone knows how to operate it, two times development needs iOS code integration into unity, in fact, integration is very simple to find the Iphone_ in the exported Xcode project The Onunityready () method in view.mm, unity is also equivalent to a view in iOS,[getappcontroller()showgameui:_ Maindisplay,window]; Load the game view, this method in Unityappcontroller,-(void) Showgameui: (uiwindow*) window, show view as _rootview, Want to integrate their own view, addsub on it, the specific will be iOS to understand, will not be the first to understand the iOS, the interaction is very simple,
The code for unity and iOS interaction must be written in the class under the exported project class file, where the call is not responding elsewhere, Unity calls iOS
[DllImport ("__internal")]private static extern void _hideview (); [ DllImport ("__internal")]private static extern void _displayingview (); [ DllImport ("__internal")]private static extern void _sendjsondata (string stringvalue); [ DllImport ("__internal")]private static extern void _rotatetrigger (int index);
Unity calls the iOS declaration interface, which passes parameters, and invokes the appropriate method when used. _rotatetrigger(-1); Recommend that you judge the device to call,
iOS side
+ (void) Rotatefurnitureto3d: (const char *) strangle{ unitysendmessage ("Target", "rotatefurniture", strangle);}
This is the iOS call unity using code, write it in the corresponding class, unity has provided the appropriate method,
But Unity calls iOS, because unity is the C # calling code OBJECT-C does not support
extern "C" { void _sendjsondata (const char* stringvalue) { [Ardbmanager Storeprogramjson: StringValue];} }
Can realize the interaction, specific people can do a test, do not understand the exchange at any time, a little progress every day