Android not working - fix candidate
JRRomacho opened this issue · 1 comments
JRRomacho commented
I thought that was an issue related to shaders, but looks like there is something about render textures.
Replacing:
viewTexture = new RenderTexture (Screen.width, Screen.height, 0);
by:
viewTexture = new RenderTexture (Screen.width, Screen.height, 24);
Portals are rendered, but with no recursion.
Why is this happening? Is feasible to fix recursion with Android?
vegechick123 commented
I've met the problem, you can fix recursion problem by
replacing:
portalCam.Render ();
by:
RenderTexture buffer = RenderTexture.GetTemporary(Screen.width, Screen.height, 24);
portalCam.targetTexture = buffer;
portalCam.Render ();
Graphics.Blit(buffer, viewTexture);
RenderTexture.ReleaseTemporary(buffer);
the reason is viewTexture
in origin code is used as the texture of recursion portal, when we call portalCam.Render ();
, it also used as the targetTexture of Camera.We can't read the same RenderTexture while it is being written, so the recusion is black.