Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
127 views
in Technique[技术] by (71.8m points)

java - Unity3D and Android Studio Integration

Anyone know integrate Android with Unity Studio? (i will explain)
I created a simple scene in Unity (4.3.x on OSX Maverics) for testing. Has a 3D object and nothing else.
I do this in XCode using the Stackoverflow explanations here and i post my complete code here ( Touch a UIButton and show Unity on UIView or UIViewController ) to show it's really simple.
But now, I need to do the same on Android Studio (which I installed and I can export the project from Unity to Android)
The only thing I know is that the AndroidManifest.xml and the file is in "res/layout/(something).xml" files that are the first (read) and (displays) the layout on the screen when you create a project on Android Studio.

When you open the generated project from Unity, the only XML you have is AndroidManifest.
So I'm lost. Since the document of third part site (http://www.rbcafe.com/Softwares/Unity/Documentation/Manual/android-GettingStarted.html) only mentions the Unity Eclipse and a JAVA files that do not exist in the project, makes me more lost.

In Objective-C, you create your somethingDelegate.mm and .h and inserts "a line of code" and ready. In Android does not seem to be as simple as this official document (http://docs.unity3d.com/Manual/PluginsForAndroid.html ) says.

Someone already did this in the Android Studio and could help me?

Thanks in advance.

** Edited for bounty: **

Need to create 3 views:
1 - Main View with 2 buttons;
2 - One button go to a second View;
3 - Other button go to Unity View;

There must be a simple way to do this on Android as a studio made ??the link above.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Setting up an Android project is really simple. The document you linked is outdated and you don't need to move any files at all.

Unity

  1. Goto File -> Build Settings -> Android and click Switch Platform
  2. Enable Google Android Project
  3. Click Export and choose where you want the Android project to be

Android Studio

  1. Import or open the project you have just created with Unity
  2. Done :)

If you want to display the Unity engine inside a subactivity, I suggest you take a look at this answer.

If you're completely unfamiliar with Android development, you should start with a simple "Hello World" app without complicating things by adding Unity to the mix. Just follow some of the official Android guides.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...