2

Recently I upgrade my android game from Unity 4.6 to 5.0. It runs no problem in editor. When I put it in any android mobile, it will show the following error message:

E/Unity (23691): RenderTexture warning: Destroying active render texture. Switching to main context.

How can I destroy all active render texture? Any help?

Steven
  • 166,672
  • 24
  • 332
  • 435
cscan
  • 364
  • 2
  • 9

2 Answers2

0

Try to cleanup the render texture in a OnDestroy: set RenderTexture.active and perhaps all of your Camera.targetTexture to null. If that doesn't work, there is a Release() method or a static Object.Destroy(theRenderTexture).

Also consider using temporary RenderTextures.

Please post which one worked.

Krzysztof Bociurko
  • 4,575
  • 2
  • 26
  • 44
  • Is it possible to write an universal code to locate all camera objects and clean up those texture? – cscan May 18 '15 at 02:43
0

You probably need to make changes to the Plugins/Android/AndroidManifest.xml.

Remove the following:

<activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

But copy the entire intent-filter section into the activity called UnityPlayerActivity to look like this:

<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

This solution worked for me and was taken from theprisoner6 in this thread:

Mobile game restarts when using Application.Quit

Community
  • 1
  • 1