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

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

问题描述

我目前正在尝试使用Unity3D为Android编写一个小游戏。因为我想要一个可见的状态栏,我修改了项目文件夹中的AndroidManifest(C:\Users \Public \Documents\Unity Projects \ ProjectName \Temp \StagingArea),如下所示:

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:\Users\Public\Documents\Unity Projects\ProjectName\Temp\StagingArea) 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 文件。每次构建时,您正在修改的 AndroidManifest 来自< ProjectName> \Temp \StagingArea 你的项目。

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

要使用自定义 AndroidManifest 文件,您必须自定义 AndroidManifest 文件位于< ProjectName> Assets\Plugins\Android

To use a custom AndroidManifest file, you have to put your custom AndroidManifest file at <ProjectName>Assets\Plugins\Android.

1.Go到< UnityInstallationDirecory> \ Editor\Data\PlaybackEngines\AndroidPlayer\Apk ,复制 AndroidManifest.xml 归档到< ProjectName> Assets\Plugins\Android

1.Go to <UnityInstallationDirecory>\Editor\Data\PlaybackEngines\AndroidPlayer\Apk, Copy the AndroidManifest.xml file to your <ProjectName>Assets\Plugins\Android

2.打开复制的清单文件来自< ProjectName> Assets\Plugins\Android 并添加您的清单。

2.Open the copied Manifest file from <ProjectName>Assets\Plugins\Android and add your manifest.

在您的特定情况下,添加<应用程序android:theme =Theme.Light.NoTitleBarandroid:icon =@ drawable / app_iconandroid:label =@ string / app_nameandroid:debuggable =falseandroid :isGame =trueandroid: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天全站免登陆