Where should I type this line into this shader file.
var shader = Shader.Find(“Hidden/CubeCopy”);
Shader "Hidden/CubeCopy" {
Properties {
_MainTex ("Main", CUBE) = "" {}
_Level ("Level", Float) = 0.
}
CGINCLUDE
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float _Level;
struct v2f {
float4 pos : SV_POSITION;
float4 uvw : TEXCOORD0;
};
v2f vert(appdata_base v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.uvw = v.texcoord;
return o;
}
UNITY_DECLARE_TEXCUBE(_MainTex);
float4 frag(v2f i) : SV_Target
{
return UNITY_SAMPLE_TEXCUBE_LOD(_MainTex, i.uvw.xyz, _Level);
}
ENDCG
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Pass {
ZTest Always
Blend Off
AlphaTest off
Cull Off
ZWrite Off
Fog { Mode off }
CGPROGRAM
#pragma target 3.0
ENDCG
}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Pass {
ZTest Always
Blend Off
AlphaTest off
Cull Off
ZWrite Off
Fog { Mode off }
CGPROGRAM
#pragma target 2.0
ENDCG
}
}
Fallback "Diffuse"
}
Any solution to these appreciated here!
That is C# line. You can put that into your C# monobehaviour script. Not into the shader code.
That line doesnt go in the Shader.
You use it to Find your shader of the same name when setting up a Material