下面的组件做一个记录,可以使ui自己设置单个文字上下颜色,最终效果为,仿照艺术字
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
[AddComponentMenu("UI/Effect/UIColorGradient")]
public class UIColorGradient : BaseMeshEffect
{
public static List<UIVertex> helpList = new List<UIVertex>();
private bool isText;
private bool isCheck;
[SerializeField]
private Color32 topColor = Color.yellow;
[SerializeField]
private Color32 bottomColor = Color.red;
protected override void OnEnable()
{
base.OnEnable();
if (this.gameObject.GetComponent<Text>() != null)
isText = true;
else
isText = false;
}