Search Unity

Question Saved Texture2D doesn't update RenderTexture at all. Why does this happen?

Discussion in 'General Graphics' started by solocs, Aug 11, 2021.

  1. solocs

    solocs

    Joined:
    Jun 16, 2017
    Posts:
    9
    I just can't seem to figure out why I can't save the image I've drawn onto an orthographic RenderTexture.

    Here's how my scene works: https://i.imgur.com/jAWO2V8.gif

    Basically, it's a painting effect using a ParticleSystem that draws a trail based on where I click and hold my mouse. As soon as I let go of my mouse, it saves the current RenderTexture into a cached Texture2D reference which is clearly shown here: https://i.imgur.com/rDMJ3Xa.png

    The problem here is that the main RenderTexture (BrushRT) is not taking the saved Texture2D data and keeping it. The intended effect is to have the RenderTexture save everything I've drawn so far. It doesn't do so and the ParticleSystem just disappears as shown here: https://i.imgur.com/ucNs3tV.gif

    Here's the code to the TextureSaver script I'm using: https://hatebin.com/wtfyhjcqst

    Here's the ShaderGraph: https://i.imgur.com/cIAXEKb.png

    Any help would be appreciated. I've been stuck on this for weeks!

    Add comment