在 Unity 中使用自定义清单文件和权限? [英] Use custom Manifest file and permission in Unity?

查看:38
本文介绍了在 Unity 中使用自定义清单文件和权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用 Unity3D 为 android 编写一个小游戏.因为我想要一个可见的状态栏,所以我修改了项目文件夹(C:UsersPublicDocumentsUnity ProjectsProjectNameTempStagingArea)中的AndroidManifest,如下所示:

Im currently trying to program a little game for android with Unity3D. Because I want a visible status bar, I modified the AndroidManifest in the Project Folder (C:UsersPublicDocumentsUnity ProjectsProjectNameTempStagingArea) like this :

<application android:theme="Theme.Light.NoTitleBar" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">

但是每次我生成 APK 时,unity 都会将 Android Manifest 更改为:

But everytime i generate the APK, unity changes the Android Manifest to this :

<application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">

Unity3D 是否每次都会更改我修改后的清单?

Unity3D does change my modified Manifests everytime?

推荐答案

您正在修改错误的 AndroidManifest 文件.您正在修改的 <ProjectName>TempStagingArea 中的 AndroidManifest 是每次构建项目时由 unity 生成的.

You are modifying the wrong AndroidManifest file. That AndroidManifest from <ProjectName>TempStagingArea you are modifying is generated by unity each time you build your project.

要使用自定义 AndroidManifest 文件,您必须将自定义 AndroidManifest 文件放在 AssetsPluginsAndroid.

To use a custom AndroidManifest file, you have to put your custom AndroidManifest file at <ProjectName>AssetsPluginsAndroid.

1.转到EditorDataPlaybackEnginesAndroidPlayerApk,将AndroidManifest.xml文件复制到你的;AssetsPluginsAndroid

1.Go to <UnityInstallationDirecory>EditorDataPlaybackEnginesAndroidPlayerApk, Copy the AndroidManifest.xml file to your <ProjectName>AssetsPluginsAndroid

2.从 AssetsPluginsAndroid 打开复制的 Manifest 文件并添加您的清单.

2.Open the copied Manifest file from <ProjectName>AssetsPluginsAndroid and add your manifest.

在您的特定情况下,添加 <application android:theme="Theme.Light.NoTitleBar" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner"> 到它.保存、构建和运行.

In your particular case, add <application android:theme="Theme.Light.NoTitleBar" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner"> to it. Save, Build and Run.

Unity 现在将使用该 AndroidManifest 文件.如果您遇到崩溃或任何其他问题,那么 Unity 不希望您更改它.

Unity will now use that AndroidManifest file. If you get crash or any other problem, then Unity does not want you to change that.

这篇关于在 Unity 中使用自定义清单文件和权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆