You don’t need to mind that it’s just, if you are using Google play services in your project and having your own AndroidManifest.xml file with a integer line of Google play services version inside and try to build it form /Plugins/Android folder, well Unity gets mad so I prefer storing my Manifest.xml file and swapping it. xml files inside /Editor/Files folder if you have any. Note(irrelevant with tutorial): I’m copying also. ![]() You can check out the api documentation from PostProcessBuildAttribute from here. Then I just wrote a postprocess script that swaps our java file with Unity that builds after you export the project. Folder name is irrelevant actually it’s what I choose. What I did was taking this file and adding the java methods inside this and putting under Assets/Editor/Files folder. You can find this java file if you export the project as google android project under src/yourpackagename/ folder. You can take a look at UnityNativePlayerActivity.java file there. The demo project contains all java codes that we will call, inside /GoogleAndroidExport_experimental/UnityAndroidExtras/Editor/Files folder. You can find this script inside /GoogleAndroidExport_experimental/UnityAndroidExtras/Plugins/ folder. From this script we are just calling our java methods. I’m not going to explain this part in details, if you look at my previous tutorials you can easly understand the work here. The only thing you need to do is export it and run it from Eclipse thats all! You can make your own changes add your own methods inside it. You can find the java file we are copying inside UnityAndroidExtras/Editor/Files folder. Hack: For this I made a post process build script with some System.IO methods that changes unity exported UnityPlayerNativeActivity.java automatically after your build is done, so that we will never deal with copying and pasting same methods over and over. We are adding our java methods into freshly build google android project thats why build and run option from Unity won’t work! And yes every time you export your project you have to add your methods into UnityPlayerNativeActivity.java unfortunately.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |