Window Computer Lock causes a problem

Almost every time I lock my computer (window switch user kinda thing),

it causes a problem.

I use a texture2D created from gui text on render texture which is set as render target of a camera.

if the process of making texture2d runs when the computer is locked,

the string does not appeal appropriately.

Can anyone help me with this problem?

Thanks.

It’s been a while since I was working on a product that had this issue too. I think we solved it through recreating the texture during OnApplicationFocus.

Something along the lines…

void OnApplicationFocus(bool focus)
{
  if (focus)
    RebuildYourRenderTargets(); // Obviously you need to implement this yourself.
}