I have a method that uses readpixels to create a texture and assign it to a material
I am using MaterialPropertyBlock.SetTexture to set it
each time I run the method the ram increases by 10Mb
Even though I am always overwriting the same property block
I think all these textures arent getting unloaded/Destroyed?
Everytime I run the method I dont need the old textures, only the new one
Can someone give me some advice on how to proceed?
It’s also possible that if you feed a texture into this endpoint, perhaps Unity makes a copy.
If so I would expect that your previous texture injections would simply be lying around without any references and therefore be eligible for UnloadUnusedAssets() cleanup, which of course fires automagically when you change scenes.
If you call UnloadUnusedAssets() after setting your new texture, does the leak still occur?