I'm working on an editor extension for a custom GPU particle system. The system generates source code for a compute shader, and I need to turn that source into a ComputeShader instance. Basically, I'm looking for the ComputeShader equivalent of `UnityEngine.ShaderUtils.CreateShaderAsset()`.
I know I could save the shader to a ".compute" file and manually refresh AssetDatabase, but there are two problems with this approach:
1. I have to go through the hard drive and then wait for AssetDatabase to catch it, which is slow
2. This shader is ultimately going to be attached to a ScriptableObject in a ".asset" file; it will not have its own file on the disk.
↧