Search code examples
androidunity-game-enginesettingshardware-acceleration

Unity - force Android hardware acceleration


I made a 2D game that uses post-processing effects. As a result, the game runs fine on my old crappy tablet when post-processing is off and stutters when it's on, but I'd like to explore my possibilities.

Is there a way to force android hardware acceleration in my Unity projects?

Edit: I put this manifest inside my project's android folder.

Did I do it right? No significant difference in performance.

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools"
    android:installLocation="preferExternal"
    android:versionCode="1"
    android:versionName="1.0">
    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true"/>

    <application
        android:hardwareAccelerated="true"
        android:theme="@style/UnityThemeSelector"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name">
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>

The editor screenshot:

enter image description here


Solution

  • Just add android:hardwareAccelerated="true"> to the Android Manifest inside the <application tag. That's it.

    Here are the steps:

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

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

    Add android:hardwareAccelerated="true"> to it after <application. Save, Build and Run.