For the Android platform we need to learn how to call Android Java code in unity.

Source: Internet
Author: User

Unity for Android is special, unity for IOS Packaging is to give the Xcode project directly to the developer, developers can continue to add new views on the basis of the project, and finally by the developer to package the creation of the IPA package, publish the program. and the unity for Android package directly generated APK package, is equal to saying that the source code developers are not visible, but unity itself is a bit limited, for the Android platform we need to learn how to call Android Java code in unity. Our goal in this chapter is to use Unity's script to open activity. First we create a generic Android project, as shown in the directory structure.

Because the project needs to use the interface provided by unity, the interface Classes.jar needs to be introduced into the current project but. The location of the interface Pack, open the finder-> application->unity-> click on the Unity icon, right mouse button Select “ Show Package Contents ”->Contents-> Playbackengines->androidplayer->bin->classes.jar. After the interface package is introduced into the project, the Java code begins.

Unitytestactivity.java


Http://www.qdmm.com/BookReader/1163793,22699652.aspx
Http://www.qdmm.com/BookReader/1163793,22719361.aspx
Http://www.qdmm.com/BookReader/1163793,65455160.aspx
Http://www.qdmm.com/BookReader/1163793,65455311.aspx
Http://www.qdmm.com/BookReader/1163793,65455315.aspx
Http://www.qdmm.com/BookReader/1163793,65455341.aspx
Http://www.qdmm.com/BookReader/1163793,65455366.aspx
Http://www.qdmm.com/BookReader/1163793,65455374.aspx
Http://www.qdmm.com/BookReader/1163793,65455420.aspx
Http://www.qdmm.com/BookReader/1163793,65455438.aspx
Http://www.qdmm.com/BookReader/1163793,65455443.aspx
Http://www.qdmm.com/BookReader/1163793,65455459.aspx
Http://www.qdmm.com/BookReader/1163793,65455463.aspx
Http://www.qdmm.com/BookReader/1163793,65455464.aspx
Http://www.qdmm.com/BookReader/1163793,65455468.aspx
Http://www.qdmm.com/BookReader/1163793,65455471.aspx
Http://www.qdmm.com/BookReader/1163793,65455475.aspx
Http://www.qdmm.com/BookReader/1163793,65455483.aspx
Http://www.qdmm.com/BookReader/1163793,65455486.aspx
Http://www.qdmm.com/BookReader/1163793,65455491.aspx
Http://www.qdmm.com/BookReader/1163793,65455494.aspx
Http://www.qdmm.com/BookReader/1163793,65455498.aspx

Package Com.xys;   Import Android.content.Context;   Import android.content.Intent;      Import Android.os.Bundle;      Import com.unity3d.player.UnityPlayerActivity;          public class Unitytestactivity extends Unityplayeractivity {/** Called when the activity is first created. */       Context mcontext = null; @Override public void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);

For the Android platform we need to learn how to call Android Java code in unity.

Related Article

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.