- Home /
Callback when (compute) shader is reloaded
When you change the source of a shader during Play mode, Unity recompiles and hot swaps the shader. Unfortunately, it looks like compute shader properties are not restored after the hot swap. The textures that I set on my compute shader become null after the reload.
Is there a way to be notified or detect a shader hot swap, so that I can reassign the shader properties? It seems like this is different from a full C# assembly hot swap. If you only change the shader code, the C# scripts are not reloaded and therefore, the usual solutions don't seem to work.
Here's what I've tried so far:
DidReloadScripts annotation
Use computeShader.GetInstanceID() and see if it changes after a hotswap (it doesn't).
Your answer
Follow this Question
Related Questions
'Unsupported type' error in custom editor script 4 Answers
Seperating editor and runtime data with ScriptableObjects 1 Answer
Preview procedural texture in scene without serializing it? 1 Answer
Don't save gameobjects to scene file (No hide flags) 0 Answers
Differences between DrawMeshInstanced & DrawMeshInstancedIndirect 0 Answers