- Home /
Create Shader from string
Hello, I am working on a math-plotter for displaying values depending on other values. Eg plotting f(x)= x²-3*x+3
Because I stayed long back at my 5.4-version i didn't realised until now, that Unity removed the material constructor taking a string as content.
Until now my plan was creating a default plotting shader containing a marked part to replace by given function (like a c++ macro). This is why a .shader-file wouldn't help here.
Is there any way to circumcise that problem? Maybe using a default glsl-compiler via native call?
As now i see 2 possibilities: - use Texture2D.SetPixel32 - use https://answers.unity.com/questions/1204687/how-can-i-use-unityshadercompilerexe.html
Both ways would create a texture with a fixed size, which can only be scaled and is already rasterized