Unity Community


Page 1 of 6 123 ... LastLast
Results 1 to 20 of 106

  1. Posts
    4

    Integrating Unity and Eclipse

    Hello everyone!

    I've been testing out Unity for the past couple of weeks to come to terms with the development pipeline and how it integrates with Android.

    Some issues have popped up, and also some solutions. Specifically, the build process and requirements to introduce plugins into Android-Unity projects is not quite straight-forward, and some steps are fairly hard to manage:

    • Integrating Android resources is, as I understand it, being worked on in the beta, but not yet there in release, and resource collisions still cause problems.
    • Working with Eclipse is complex, especially with regards to debugging the Java aspect of apps.
    • Some people have described issues when using custom icons and the like for market apps. (e.g. http://forum.unity3d.com/threads/713...it-look-so-bad)
    • Building a Unity project where a 2D Android interface is then to be integrated.


    To this end, I have devised a process, which, at the moment, works well, and provides better integration with the android pipeline, as well as potentially better integration with shared Java libraries in Eclipse.

    However, this process involves accessing data from the temporary folder for the Unity project, "$ProjectRoot/Temp/StagingArea", meaning it is not future-proof, as Unity Android is not a fully released product yet and subject to change.

    For now, here is the solution I have constructed, in a fairly simple step-by-step manner:

    Prerequisites:
    Android SDK, NDK
    Eclipse, configured for usage with Android
    Unity Pro / Android advanced

    Note: Unlike official procedures, there is no need to introduce plugin files or any Java code into the Unity assets. Under some circumstances, you may still want to import java native libraries into the Unity project, but this is not necessary.

    1. Set up your Unity Android project as you would normally and hit Build.
    2. Enter your project folder, go to Temp/StagingArea.
    3. Copy all project files to a new folder.
    4. Import this folder as a new Android project in Eclipse.
    5. Mark this project as a library in the properties window for the project. (Right click on the project name, go to Properties->Android and mark "Is Library".)
    6. Create a new Android project in Eclipse. This will constitute the Java part of your project.
    7. Add the Unity Android project as a library to your new project. (Right click on the project name, go to Properties->Android, select "Add...", add the project.)
    8. Add the classes.jar library to the Library references for your new project. (In properties, go to Java_Build_path->Libraries, select "Add External Jar...", navigate to UNITY_INSTALLATION\Editor\Data\PlaybackEngines\and roidplayer\bin and add classes.jar)
    9. Move the assets folder from the library project to the new project. (Android does not allow assets to be utilized in libraries, and this last step has to be repeated whenever the Unity project is rebuilt.)
    10. Optionally, copy the AndroidManifest file from the library project to the new project, as it contains some Unity configuration and will not be used unless moved to the executable project.


    Note that you will lose the one-step build process once you begin integrating the two projects in Eclipse, as the project has to be built in Unity, the asset folder copied to Eclipse and the whole project built again. Most of this process can be automated fairly easily using scripts however.

    At this point, you can instantiate an Activity as normal in Android, either by setting up a class extending UnityPlayerActivity, or rebuilding it yourself, as the source code for it is available and documented in UNITY_INSTALLATION\Editor\Data\PlaybackEngines\and roidplayer\src\com\unity3d\player. How to do this is available at http://unity3d.com/support/documenta...l/Plugins.html.

    Once all of this is done, your library folder contains the assets utilized by the Unity engine (basically, the splash icon and an XML layout) and never has to be touched again. The only requirement that is posed here is that the asset folder in the new project is updated whenever the Unity project is recompiled. Any references to native libraries that need to be utilized in Unity can be managed in the new java project as in a normal Android project. Icons, debugging, signing, and other android-integration can now be managed from Eclipse.

    I release this hoping it will make your integration process with Unity easier, hope you enjoy.


    Linus Mårtensson
    Last edited by Linusmartensson; 12-22-2010 at 03:37 AM.


  2. Posts
    24
    Hi! Thank you for this guide, 'couse I really need it. I never worked with Eclipse, so it's complicate to me a bit. A need to import an Uity project to Eclipse, 'couse my boss wants to add to the project different simple components like menu and other things.
    I've stacked at the point 4. I dont have the menu "Import as Android Project" in the "Import" in Eclipse. If I am trying to import "Existing Projects into Workspace", Eclipse tells me that he cant find a project in the pointed folder. So as like I am trying to create a new Android project - there are bad things too
    So what is supposed me to do? Thank you!

  3. Lead Developer



    Location
    Stockholm, Sweden
    Posts
    383
    Quote Originally Posted by WhiteDevil View Post
    I dont have the menu "Import as Android Project" in the "Import" in Eclipse.
    Did you install the ADT plugin for Eclipse?


  4. Posts
    4
    Well, I don't have Eclipse in front of me at the moment (since I'm not at work), but I believe what you have to do is create a new android project and in the window that opens up, select an option called something like "create project from existing source", then pick out the directory.


    Linus


  5. Posts
    1
    Thank you for your guide . I have followed all steps already and now I have a problem about how to control my model in Unity by using Eclipse. Can you give me any suggestions?;(


  6. Posts
    24
    Hi everyone again. I'm sorry for my notanswering

    Erique:
    Well, it was found out that ADT plugin had been installed.
    If I want to create a new project THERE IS the "Android" folder
    But I dont have one when I want to "Import" project.

    Linus, here are my steps:
    1) Creating new project
    2) selecting "Android project"
    3) selecting "Create project from existing source" and pointing on Unity3d project
    4) bad thing. Eclipse is trying to find "AndroidManifest.xml" which definetly doesnt present in Unity project

    Thank you and help me plizzzzzz))
    Last edited by WhiteDevil; 01-11-2011 at 08:09 AM.

  7. Lead Developer



    Location
    Stockholm, Sweden
    Posts
    383
    Quote Originally Posted by WhiteDevil View Post
    4) bad thing. Eclipse is trying to find "AndroidManifest.xml" which definetly doesnt present in Unity project
    Sure it is, under Temp/StagingArea after creating the build inside Unity. As Linus described:

    Quote Originally Posted by Linusmartensson View Post
    1. Set up your Unity Android project as you would normally and hit Build.
    2. Enter your project folder, go to Temp/StagingArea.
    (...)


  8. Posts
    24
    Which build? In Unity3d when building I create only .apk file
    As I understood StagingArea - is a Unity3d project

  9. Lead Developer



    Location
    Stockholm, Sweden
    Posts
    383
    Quote Originally Posted by WhiteDevil View Post
    Which build? In Unity3d when building I create only .apk file
    Yes, and during this process it outputs temporary files under Temp/StagingArea.


  10. Posts
    24
    Oooh, thanks. The feedback will be soon


  11. Posts
    24
    still can't import errors during importing:

    [2011-01-11 19:16:51 - UnityPlayerActivity] Warning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.
    [2011-01-11 19:16:51 - UnityPlayerActivity] D:\Temp\ndroidProject\AndroidManifest.xml:2: error: No resource identifier found for attribute 'installLocation' in package 'android'

    change:
    Opened via "Pulsar Perspective". I think imported correctly.. at last

    change:
    I made everything stepbystep. But when I try to make a build in Eclipse I get the errors mentioned in this message

    change:
    fixed the problem setting in the manifest "using sdk = 7" but in the project properites sdk was set to android 2.2
    http://mobile.tutsplus.com/tutorials...ve-to-sd-card/

    Have a last error:
    "R cannot be resolved to variable" in line 11 of "OnCreate(Bundle):void" in "src" folder

    change:
    Fixed by putting the variable directly without reference on R class
    But GOD DAMMIT it still doesnt work! No errors in project files, but there is one on project
    And it isnt shown in the console! Its clear! And the project doesnt want to compile
    Jeeeesus((
    Last edited by WhiteDevil; 01-11-2011 at 11:50 AM.


  12. Posts
    24
    Oookaaaay, I have no errors! But I do not actually understand how to link 'java-part' project to the 'unity-part' project.
    For instance in Java project I have an activity class which loads the 'hello Android' window. After this I want to load the unity build.
    So what do I need to do?

    Thanks
    Last edited by WhiteDevil; 01-12-2011 at 02:32 AM.


  13. Posts
    45
    hi
    i was working with this latest days...
    you need to read this Extending the UnityPlayerActivity Java Code
    http://unity3d.com/support/documenta...AndroidPlugins

    then in the manifest you put YOUR actitity to be lauched and then when you want using an intent lauch the unity3D activity


  14. Posts
    24
    sounds difficlult but thanks
    i just want to ask a few questions to be sure that there is sense to do this thing:

    1) Unity3d scripts have been compiled already and they cannot be modified?
    2) There is no access to data files, like models, textures, so they cannot be modified either?
    3) While Unity3d application working I cannot use Java-part functionality?
    4) So, this integrating is only for making pre-unity3d preperations, like 2D main menu etc, right?


  15. Location
    India
    Posts
    26
    Hi call u hellp me in integration of unity project in eclispe i have lot's of problem....my mail id is a.verma.2906@gmail.com send a mail when u r online


  16. Location
    india
    Posts
    22
    hiii everyone,
    i am new to the unity3d.i am developer in android.i develop a module in eclipse for android.I want to integrate with unity 3d.Can anyone please tell the steps for this.


  17. Posts
    24
    there are the steps you required in the first post


  18. Posts
    12
    Hii WhiteDevil
    I am able to integrate eclipse and unity3d,When the unity activity is running i want to show a menu when menu button is pressed...I tried this out with oncreateOptionsmenu but it didnot work..Can u help me out??


  19. Location
    Germany
    Posts
    103
    you can add views in your activity like this for example:
    Code:  
    1. getWindow().addContentView(myView, new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    If you want to call a Java method from C# you have to write a plugin. Find a guide here.


  20. Posts
    12
    Hii Robhuhn
    What is myView in the above code,when we extend a unityplayer activity ther will be no view object then where will we get the view object from??

Page 1 of 6 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •