Skip to content

Commit 0552c5c

Browse files
SolidAlloyxsduan
authored andcommitted
Added a shader to replace color of the texture
I haven't found a default shader with such behaviour, so made a very simple custom one. It acts the same way as the previous GetWhiteTexture method: sets RGB values of the set color, but leaves alpha of the original texture.
1 parent 86c6147 commit 0552c5c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Editor/ReplaceColor Shader.shader

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Shader "UI/Replace color" {
2+
3+
Properties
4+
{
5+
_Color ("Replace Color", Color) = (1,1,1)
6+
_MainTex ("Texture", 2D) = "white"
7+
}
8+
9+
SubShader
10+
{
11+
Pass
12+
{
13+
SetTexture [_MainTex]
14+
{
15+
ConstantColor [_Color]
16+
combine constant + texture, texture
17+
}
18+
}
19+
}
20+
21+
}

Editor/ReplaceColor Shader.shader.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)