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:
Scene view, left = canvas, mainCamera and raw image, right = 3D Dice Area with seperate camera:
Close up for the 3D Dice area:
The Render Texture:
The camera in the 3D dice area with the render texture:
The Raw Image in the canvas with the render texture:
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.