RawImage with RenderTexture texture not working on Android
Hello!
We want to have some 3D models appear on top of our GUI (we use Canvas), so we decided to have an extra camera render those objects to a RenderTexture. Then, in the canvas, we have a Raw Image that uses the texture and is the top (closes to camera) object.
This works really well in Editor and on iOS, but not at all on Android. It's as if nothing gets rendered to the RenderTexture.
I tried changing settings, making sure that the RT is power of two, and also did a printout to check if the references on the Camera or Raw Image were lost ( they were not ). Now i'm out of ideas.
Here's a screenshot from the editor, showing how it's supposed to look.
Question: your object is stationary or has any animation or script to do it rotate
It's not 100% stationary, it's position is bound to the position of the background panel, so if the panel moves, the object moves. But no rotation. The panel is on a scroll bar so i does move.
the issue is that unity has a problem with rotation to export to android, you have to use identity quaternion angle either in the animator "if it is doing for animation" or on code if using a script. till now I thought that was the main problem.
Answer by Cousken-iGotcha · Aug 25, 2016 at 01:57 PM
I was getting quite desperate to fix this untill i did this printout:
Editor:
Look at target: Target position is 74.41666, 22.16666, -1.
Look at target: Camera position is 380, 237.5, -1294.203.
Android:
08-25 13:33:44.517: I/Unity(17771): Look at target: Target position is 188, 56, -1.
08-25 13:33:44.534: I/Unity(17771): Look at target: Camera position is 960, 540, -3269.564.
From this point i could clearly see that on Android the distance between my 3d Gui elements was bigger than 3000, the cameras far plane. Increasing it to 30 000 solved the issue.
I don't know why the values are different on android, editor and ISO. Possibly because the distance is dynamically created based on the size of the canvas position in world.
hahaha it usually happens, one does not realize till things that happens. : V
jaajajajajajajaajajaja
I worked out why this happens. Lots of recent Android phones have high pixel densities, so if you're auto-scaling your UI, which you probably are, and if you have the inner camera inside your UI structure somewhere, the whole thing will be getting scaled up, so moving the object out of the view frustum
Your answer
Follow this Question
Related Questions
Trying to put a canvas in Google Cardboard 0 Answers
Canvas differently displayed in built Android version and Unity Game mode. 0 Answers
How to overlay an image onto device camera(android and iOS camera, realtime) 0 Answers
Screen Space - Camera for Mobile (Android) not working 0 Answers
How to scale images corectly? 1 Answer