Unity3d SDK 91

Source: Internet
Author: User
Tags documentation
Give people to fish, rather than teach people to fishing "to Unity3d call the iOS version of 91SDK as an example, using the C #/C/obj-c interaction principle, this article will detail the Unity3d and iOS interaction between the solution.
First, open Xcode to create a new empty project, and refer to the 91SDK development documentation to introduce 91SDK and configure the environment. After the configuration is complete, create a obj-c class file named "Lssdkconector". When finished, the current project should be as shown:
LsSdkConector.h file We don't have to change it. Keep it as it is.
Next we start making the C interface in the LSSDKCONECTOR.M file and calling the 91SDK iOS method. After introducing the necessary header file, I divided the code of the file into 3 regions. The Code a zone is used to define the APIs that the C interface must implement.
The Code B area is used to implement the interface for the A zone code, and the iOS method to invoke 91SDK is straightforward, and the Code B area is written as a method to invoke the Code C area.
The Code C area is used to implement a true 91SDK Obj-c method.
Everyone in their own projects: the code a area as a direct copy of the application; The Code B area can write tool methods and call the iOS method, the code C region to write 91SDK iOS method, you need what API to write, write down in the Code B area to add C call method.
In writing code, some people might ask the API in Obj-c that there is a callback, how unity knows the OBJ-C callback is over. A: Obj-c calls Unity's API, you can use the "Unitysendmessage" method, the specific use of methods to see Uinty help.
So we finished the C interface and the 91SDK API code, next we do the uinity3d aspect of the code processing. We created the Code folder and the plugins folder under the assets of the Unity3d project. Copy LsSdkConector.h and lssdkconector.m to the Plugins folder and write our Unity call obj-c method in the Code folder. New C # file "LsSdkConector.cs", in this file, we divide the code into a, b two areas.
Code a area to write the C language interface, where the interface method to correspond to "LSSDKCONECTOR.M" in the code region B of the method name.
Code B takes the method of writing Unity3d call Obj-c, where the code note is used to implement a method call between Unity3d, C # method within the method of the call.
This completes the Unity3d access to the 91sdk-ios version of the solution.
Next, let's test if this solution works. Create a new "LisiTest.cs" file in the Code folder and edit the following code: Drag the C # file to the main Camera binding.
Unity3d to iOS project must be set Bundleidentifier, screenshot:
Click the "Build" button to create an iOS project, open the iOS project, and drag LsSdkConector.h and lssdkconector.m into the Classes folder of your iOS project
Follow the Environment configuration section in the 91SDK document, reference the SDK, add the system library, and do the environment configuration. Before you pack to your iOS device, check the configuration of your iOS project, note that OBJC is written in column 1th, and be aware of the case.
Select Use iOS device package, you will find Unity3d call iOS succeeded.
This article is to tell you the Unity3d and iOS interaction solution, code specification problem is not the focus of this article, such as 91SDK initialization in the SDK documentation is recommended in the Appdelegate file initialization.
Annex: Documents mentioned in the article. zip (2.25 KB, download number: 305)

Unity3d and Android Interaction can refer to my other article: "Real Unity3d access 91SDK Android Version"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.