Hi,
we have some rather weird issue with the render to texture feature. We create a camera in our script code which renders the visible scene to a texture. That itself works well, however the particle systems do not appear on the rendered texture. Is there something that needs to be set up to make this work or is this some limitation of render to texture?
Kind regards,
Jan
GameObject myCameraObject = new GameObject("ShaderCamera", typeof(Camera));
myCameraObject.camera.enabled = false;
myCameraObject.hideFlags = HideFlags.HideAndDontSave;
Camera mainCamera = myCameraObject.camera;
mainCamera.CopyFrom(Camera.main);
RenderTexture rt = RenderTexture.GetTemporary(200, 150, 16);
mainCamera.targetTexture = rt;
mainCamera.backgroundColor = new Color(0,0,0,0);
mainCamera.clearFlags = CameraClearFlags.SolidColor;
mainCamera.Render();
GameObject.Destroy(myCameraObject);
picture = new Texture2D(rt.width, rt.height, TextureFormat.ARGB32, false);
RenderTexture save = RenderTexture.active;
RenderTexture.active = rt;
picture.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0, false);
picture.Apply();
RenderTexture.active = save;
RenderTexture.ReleaseTemporary(rt);
