scripting custom render texture creation, assignment, shaders
I got a little fed up of dragging the (wrong) custom render texture swatches onto materials in the inspector (slightly down to my crap naming conventions & Unity's project window only showing the first 8 letters of each name- can this be changed?!), so I decided to figure out a C# script that could make this easier. The entire script is way below - I'm just going to highlight a few important lines. Shader shader = Shader.Find("custom/createdTextureShader"); This finds a shader that you've created externally. You could have a public shader variable at the top instead, so you could drop stuff into the Inspector. _init_mat = new Material(init_shader); Here we make a new material, using a specified shader type. _init_mat.SetTexture("_initTex", init_texture); Then we give it a texture file. _initTex is a property I've specified for the init_shader. Typically there is a _MainTex by default. I just wanted to see if you could specify arbitrary p...