"unity" integration with iOS, Android platform: 2, exported Android-eclipse project

Source: Internet
Author: User
Tags unity 5

This article belongs to "unity and iOS, Android platform integration" series of articles , reproduced please indicate the source .

Unity is the default export of the Android-eclipse project, after all, Eclipse for Android development in the last one or two years has only begun to decline, the user volume is very large.

Individuals think that Androidstudio is very useful and can easily solve many of the problems that eclipse cannot solve or is difficult to solve.

So I've divided the andoid project of Unity's export into two parts: Eclipse and Androidstudio.

However, I will use Androidstudio after the relevant content, I hope that still use eclipse students as soon as possible to keep up with ~

This article mainly explains the directory structure of the Android-eclipse project that unity derives.

Say first in front, this article and "unity" with iOS, Android platform integration: 1, the export of Xcode project very similar, I suggest the hand-tour developers to combine two to see ~

The version of the software I use:

Unity 5.3.5F1

Eclipse sorry. I'm only using Androidstudio now.

Preamble Step

The first step is to create a new project Build_to_ios_android

Step two, create the Plugins/android/libs/jar.jar

Plugins/android/libs/x86/cpp_native.so

Plugins/android/libs/armeabi-v7a/cpp_native.so

Streamingassets/all_emptytxt.txt

Create an empty file, directly renamed the Good, now is a simple example ~

The third step, save the scene, such as

Fourth step, open playersettings, change bundle Identifier (package name), unity inside does not modify not to let export Android ~

Fifth step, choose Android platform, export exported Android project

Sixth step, open the folder of the exported Android project

Go to the Chase

1. Program Entrance

Any program has a portal, and Unity's exported Android project is no exception, as we can see, in the Androidmanifest.xml file, the unityplayeractivity is set to the app's portal. (Androidmanifest.xml is one of the Android configuration files, please search by yourself ~)

We can see that unityplayeractivity is inheriting the activity, as to what it is I will not repeat, we can look at this article:activity Detailed (life cycle, Activate activity in various ways, state save, exit completely, etc.)

For the life cycle of an activity, we can see that there is a very useful monitoring of system events, We can also see the corresponding function in Unityplayeractivity.java, which means that we can receive these events in unity, and we will inherit unityplayeractivity and rewrite these listeners.

2, C # C + +

This is a very embarrassing problem, now 5.3.5 version does not support the use of Il2cpp under the Android platform mode, but the 5.4 version is ready to support, which I intend to wait for 5.4 of the version out of the ~

3, resources streamingassets, assets

Unity Export Android Project, the original project all kinds of resources are compressed, packaged, encrypted and stored in the Assets/bin/data folder, see, this and iOS is consistent, there are many methods of resource decryption on the Internet, we need to be able to search by themselves.

Let's focus on the Streamingassets folder in unity, about the role of this file, you can take a look at this article:Unity3d Institute of the Hand of the development of all the special folders

As we can see, the all_emptytxt.txt files in the Streamingassets folder are completely copied to the assets folder, which is not just files, but folders are also copied into the folder intact.

As for what this is for, for example, the configuration file is placed here, on the phone debugging can be directly modified in Android project configuration, without the need to re-export Android project in unity.

4, Plugins/android-Libs

Plugins/android folder usually put some *.jar, *.so files, what these files are, what use, you can look at the official documents:Building Plugins for Android

These files will be copied to the Libs folder in the Android-eclipse project and will be compiled at the time of Android compilation.

5, Unity-classes.jar, libmain.so, libmono.so, libunity.so

Unity-classes.jar is a well-packaged class of unity, and if interested classmates can go to the anti-compilation look.

Libmain.so, libmono.so, libunity.so files are the underlying CPP written by unity, and since our focus is not here, we will not start talking. (This super-outline, I have not studied ~)

6. Icon

In Unity's player settings is, we can add the corresponding icon

These icon images will be re-compressed, named last placed in the position.

about where to set the icon problem, see the project needs, if the resolution is not enough to go to the export project side to add changes ~

For example: Multi-channel packaging, you may have to replace the icon multiple times, write scripts in the Android project to automate the replacement of packaging is a good choice ~

7. Splash screen

Unity on Android is possible to set up a single picture splash screen, such as.

Android, however, is born without a splash screen, so the app will show a pre-set image in the first activity. To learn more, you can take a look at this article:Android Advanced Guide page series of Splash splash screen logo

Unity's splash screen implementation on Android should also be handled as such, note!! This idea is very important, and the flash screen of unity is the idea.

8, Player Settings, settings

There are a lot of configurations in Unity's player settings that will be reflected in the Android project, in the middle of the circle, these things are not complicated, I will not repeat.

"unity" integration with iOS, Android platform: 2, exported Android-eclipse project

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.