Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] unity3d – RenderTexture in Unity is black on Android but works fine in Editor

Posted on November 11, 2022 By

Solution 1 :

Set Depth Buffer to At least 24 bits depth

Solution 2 :

Just in case you still have problems with the black rendertexture, changing the graphic API from Vulkan to OpenGL ES3 should solve the problem, it did for me.

Credit for possible solution goes to pch4n:
https://forum.unity.com/threads/unity-rendertexture-black-when-saving-png-on-oculus-quest-android.1152818/

P.S. Please don’t ask me why or how is this solution for our problem, because I have no idea, I just started learning unity.

Problem :

I have a card game (with dice) prototype made fully with UI objects in the canvas. I made it so 3D dice are shown whenever Dice are involved in the game.

It works like this:

  • Somewhere out of view of the main camera I made a little 3D area where Dice fall.
  • This Area has it’s own camera with a render texture.
  • A Raw Image is placed in the canvas above everything else, with the render texture.
  • The view from the camera at the dice area is displayed through the Raw Image so it looks like the Dice are actually falling on the canvas.

This works perfect on PC and in the Editor. But on Android the RawImage and thus the RenderTexture is completely black. This seems to be a known issue in Unity for years now, but I can’t find a solution that works for me anywhere. Does anyone know how I can make it so the RenderTexture works on Android?

Here are some images showing the elements I described:

The Game running with 3D Dice rolling:
1

Scene view, left = canvas, mainCamera and raw image, right = 3D Dice Area with seperate camera:
2

READ  [FIXED] java - Adding custom number of array objects to v.findViewById(R.id.iterateHere1) without repeating code
Powered by Inline Related Posts

Close up for the 3D Dice area:
3

The Render Texture:
5

The camera in the 3D dice area with the render texture:
6

The Raw Image in the canvas with the render texture:
4

Comments

Comment posted by Ricardo Frederiks

I don’t know if anyone sees this, but this still is an issue I have. Hope someone can answer this. 🙂

Comment posted by Ricardo Frederiks

Thanks for your answer. I have set the depth of the DiceCamera to 24, but the render texture is still black on Android. I also tried setting the MainCamera depth to 24 and leave the DiceCamera at 0. Nothing.

Android Tags:android, unity3d

Post navigation

Previous Post: [FIXED] java – is permission needed when choosing image from gallery on android?
Next Post: [FIXED] Android Java: How to get component in a custom view? (Trying to access components via findByViewId and get null)

Related Posts

[FIXED] android – Why does sending data between activities not work? Android
[FIXED] android – Kotlin Facebook Login, logs in and skips popup Android
[FIXED] android – Error message won’t show up when putting wrong username Android
[FIXED] java – Application crashes when item from searchable spinner is selected Android
[FIXED] android – TabLayout custom view behaves different for different screen sizes Android
[FIXED] android – Dagger 2 dynamic injection when button gets clicked Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What are the main features of Islamic education?
  • Is the Jeep 4xe worth it?
  • How does the ringer work on cast iron?
  • What is the biggest size interior door?
  • Is blue raspberry an original Jolly Rancher flavor?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme