Hi there!
So… I do know that, upon shader editing (say in the editor) compute buffers will have to be re-uploaded. To that effect I created a small class that tracks asset re-import, so I can re-upload stuff, in this lines:
#if UNITY_EDITOR
OSC.Utility.AssetWacher.AddImportHandler(theMat.shader,
(shader)=>{ theMat.SetBuffer(prefix + "_mercatorNArray", mercatorNBuffer); },
new WaitForSeconds(0));
#endif
And voilà! that works.
(the WaitForSeconds is because we get the notification BEFORE the new shader is processed by Unity, so you need to wait a bit, otherwise you’ll refresh the compute buffer in the shader that’s about to be thrown out)
But… we are not home: If any shader in a project is re-imported all compute buffers to all shaders get invalidated as well. Same behaviour happens in both 2018LTS and 2020LTS.
(So my only option is to make the asset tracker type based and “if any shader has been imported, redo all compute buffer uploads” but it seems a bit extreme.)
Is is expected behaviour? What is happening to those other shaders?
Also… really, can haz compute buffers in properties? Having to write this stuff is not that hard, but it feels a bit like an oddly different approach.
Thanks!