Unity技术分享

Unity Communication with Android

2017-04-02  本文已影响0人  庄什么庄

1. Unity to Android

Android

1.1 create a new Android project--create an empty activity(define you project name, location)

1.2 create a library in file(remember to delete unimportant file under res--layout to prevent unnessary build error)

1.3 check your MainActivity

1.4 find  path of classes.jar of unity under Mac environment

1.4.1 add unity classes.java to the library you just create minutes ago, and then make module you library

1.4.2 after you build your library, you will see some new file under the classes.jar

1.5 Android method you want to call by unity

1.6 add file to unity (remember to create folder Plugins/Android in UnityProject

1.6.1  after replace unity jar, you can see you file content below


Unity

1.7 Create unity function to call Android Method

1.7.1  click button, unity call the function , and the function will call Android function

1.8 build and run

1.8.1 open the android apk

1.8.2  click button

上一篇 下一篇

猜你喜欢

热点阅读