Unity3d import to Google Play services plug-in Project

Source: Internet
Author: User

tag: Android blog Io uses the AR file SP Div C

最近在给unity工程尝试接入google play services插件,遇到了些问题,记录一下。

之前在做android插件的时候,都是自己创建一个android工程,把生成的.class文件打包成jar包,然后把libs文件,AndroidManifest.xml文件一齐都放到Assets/Plungins/Android目录下。在Unity里运行build就可以得到apk文件。而最开始遇到google play services时,突然不知道该怎么做了。最开始尝试把google play services也打成jar包,按以前的方法来做,但是这条路行不通。尝试了好几次,在一次偶然的机会,看到别的android插件里有已经加入了google play services的例子。才发现是需要将google play services工程里的内容,整个都拷到unity工程中,在Assets/Plugins/Android/目录下新建个google_play_services_lib目录,将libs, res, src, .classpath, androidmanifes.xml, proguard, project.properties都拷到这里。

在做好上面一步之后,很开心又解决一个问题,点击build,却发现得到的不是apk而是红色的error。。。

新的问题是因为在google_play_services_lib/res/目录里的meta文件,在打包成apk的时候不被识别。metafile是unity提供用于version control使用的。我们使用的是tortoisesvn来管理工程的版本,就需要用到这些meta文件。但是现在这里却出现了在不该出现的地方。

好吧,最后的解决办法,在调用unity的编译apk的方法(BuildPipeline.BuildPlayer)之前,调用

UnityEditor.EditorSettings.externalVersionControl = "Disabled";AssetDatabase.Refresh();

 自动编译又可以正常运行了!

 

unity3d 导入google play services插件工程

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.