private void Update() { if (_cameraConstraint != null) { EnsureRenderTexture(); // // reuse main camera // var cam = Camera.main; // var pos = cam.transform.position; // var targetTex = cam.targetTexture; // cam.transform.position = _cameraConstraint.EvaluatePosition( _railPosition ).To3DXY( -10 ); // cam.targetTexture = _renderTexture; // cam.Render(); // cam.transform.position = pos; // cam.targetTexture = targetTex; var cam = Camera; cam.CopyFrom(Camera.main); cam.depth += _displayOnGameView ? 1 : -1; cam.transform.position = _cameraConstraint.EvaluatePosition(_railPosition).To3DXY(-10); if (_zoomConstraint != null) { cam.orthographicSize *= _zoomConstraint.GetZoom(_railPosition); } cam.renderingPath = RenderingPath.UsePlayerSettings; cam.targetTexture = _renderTexture; cam.Render(); cam.targetTexture = null; } }