Unity Communication with Android & IOS

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


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容