Unity Shader Code with “BASIC×SHADER”
To set a shader to Unity object, assign through a material. Let's create object for display, material for the object, and shader for the material.
Create a sphere object via GameObject > 3D Object > Sphere
from the Unity Editor menu.
Create a material file via Assets > Create > Material
from the Unity Editor menu. Assign the material to the object.
Create a shader file via Assets > Create > Shader > Unlit Shader
from the Unity Editor menu. Replace the contents of shader with the code below and assign the shader to the material.
Shader "BASICxSHADER/Unlit" {
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
float4 vert(float4 vertex : POSITION) : SV_POSITION {
return UnityObjectToClipPos(vertex);
}
fixed4 frag() : SV_Target {
return fixed4(1.0, 0, 0, 1.0);
}
ENDCG
}
}
}