Because the project needs to use the interface provided by unity, You need to introduce the interface classes. Jar

Source: Internet
Author: User

Unity for Android is quite special. In unity for iOS packaging, the xcode project is directly handed over to developers. developers can

Add a new view, and then the developer packs and generates the IPA package and releases the program. While unity for Android package

Directly generating an APK package means that source code developers cannot see it, But unity does have some limitations.

You need to learn how to call Android Java code in unity. In this chapter, we aim to use the unity script to open the activity.

First, create a common android project. The directory structure is shown in.

 

 

 

 

Because the project needs to use the interface provided by unity, You need to introduce the interface classes. jar to the current project. Interface

The location of the package. Choose "Finder"> "application"> "Unity"> "Unity". Right-click the unity icon and choose "& ldquo;" to display the package content.

& Rdquo;-> contents-> playbackengines-> androidplayer-> bin-> classes. jar. After the interface package is introduced into the project, open

Write Java code.

 

Unitytestactivity. Java

 
Http://www.qdmm.com/BookReader/1163793,22685467.aspx
Http://www.qdmm.com/BookReader/1163793,22685479.aspx
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
Http://www.qdmm.com/BookReader/1163793,65455503.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 );


?

Because the project needs to use the interface provided by unity, You need to introduce the interface classes. Jar

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.