releasing render texture that is set as Camera.targetTexture!

Hello all,
releasing render texture that is set as Camera.targetTexture is a problem that has popped up for many people with no solution. When you create a render texture in code, for example:

  // Create a render texture
  panelTexture = new RenderTexture((int)imageSize.x, (int)imageSize.y, 24, RenderTextureFormat.ARGB32);
  panelTexture.antiAliasing = 2;
  panelTexture.Create();
  panelImage.GetComponent<RawImage>().texture = panelTexture;

  panelInfo.panelCamera.targetTexture = panelTexture;

If you press “Alt +Enter” to toggle fullscreen or not, then the “releasing render texture that is set as Camera.targetTexture” error will pop up (I’m using SRDebugger to determine this). The result is the render texture turning completely white and all objects involved with that object like my panelCamera.targetTexture no longer have a reference to it.

Can anyone out there suggest a way to keep the render texture during full screen toggle?

@karl_jones any thoughts on this?

I’m not aware of this issue. Have you filed a bug report?

I have not. I’ll do so when I’m at my computer. Here are a few links from people with the same issue.

https://www.reddit.com/r/playrust/comments/42iert/irreversible_white_screen_of_death_after/

1 Like

Yes, this has been a bug for a very long time.

That is correct. They fixed it on I believe 5.4. Thanks for the reply.

I experienced it in 5.5 yesterday

Did anyone file a bug report?

I can’t reproduce it. It’s random. It happened twice, when I Saved the scene. But it doesn’t happen all the time. There doesn’t seem to be any rhyme or reason.

I’m getting this error when saving my scene. All of the Cameras lose their references to the RenderTexture upon saving. The project’s quite big so I don’t think I’ll be able to file a report, seems random.

1 Like

Getting this in 5.6.0f3
I have a script(ExecuteInEditMode) that creates RenderTexture’s and assigns them to cameras on the same GameObject.
They seem to get released(inconsistently) when I play/stop.

Can you file a bug report please?

Will try to repro/submit later if I have time.

2 Likes

Hi
Just sent an bug report with this error.
Almost empty scene while testing HD Pipeline with 2018.2.0f2
Target Texture field under Camera Output Settings is empty of course

1 Like

Would you mind linking your issue number so I can also track it please?

I’ve filed a bug report.

2018.3 when coming back from gameplay to main menu I get this err. In gameplay there is a minimap that uses a render texture.

I encounter the same problem using 2018.3. do you find the solution?

no, still there in 2018.4, seems harmless tho, still an sception in console…

thx for reply. On some android phones, i guess this problem leads to crash of my game