Unity Android Integration Guide

Source: Internet
Author: User

Original address: http://blog.csdn.net/alking_sun/article/details/36175187

1. The Android layer develops and exposes the interface.

    • Launcher activity (hereinafter referred to as Unityactivity) is best inherited com.unity3d.player.UnityPlayerActivity
    • Unityactivity do not set the view (Setcontentview (r.layout.unity_start), otherwise the packaged APK interface is the set view
    • Interfaces such as: public void functionname (Params param ...); The params is best string,int, long et primitive
2. Run the Android program. No accident will be error, and is unable to find the Mono library. 3. After the packaging jar runs the program, the IDE will generate the APK file, in the same folder, there will be folders such as COM, inside the file structure is the package structure of Android.  Running JAR-CVF Plugin.jar com\ will generate Plugin.jar under the folder and place it under the Project\bin folder. 4. Write the interface in Unity: 1. Get Unityactivity:androidjavaclass Cls_unityplayer = new Androidjavaclass ("Com.unity3d.player.UnityP Layer ");
 androidjavaobject activity  = cls_unityplayer.getstatic<androidjavaobject> ("currentActivity");  2. Calling method: Calling the Void method activity. Call ("functionname", param ...);   Call return value activity. Call<return type> ("Functonname", params ...);  5. Putting a resource file: File agency asset-plugins--androidandroidmanifest.xml---assets---bin      Plugin.jar---libs---res----drawable----layout----Valus NOTE: Libs must be removed Unity.jar Pack apk in playersetting inside the bundleridentifier must and manifest inside the package corresponding.

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.