Unity typewriter color changing effect
achieve effect
Difficulties in implementing project file download
The color of the last word of the printed text is different from the color of the previous text, and gradually changes to the color of the previous text after printing.
Implementation ideas
Considering that the color of the text component of unity is modified as a whole, the position of the shader is used to judge and modify the text color.
shader source code
Shader "Unlit/TextColor"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Color("Text Color", Color) = (1,1,1,1)
_Colornew("new Color", Color) = (1,1,1,1)
_X("x",Range(-1920,1920)) = 0.1
_Y("y",Range(-1920,1920)) = 0.1
_T("time",Float) = 0
}
SubShader
{
Tags {
"Queue" = "Transparent"
"IgnoreProjector"