文字にグラデーションをつける
すでにありそうなもんだけど、uGUIの文字にグラデーションをかける機能を書いた。
これが
こうなる
using UnityEngine; using System.Collections; using System.Collections.Generic; namespace TSKT { public class Gradation : UnityEngine.UI.BaseVertexEffect { [SerializeField] Color color = Color.white; [SerializeField] bool[] targetVertices = {false, false, true, true}; public override void ModifyVertices(List<UIVertex> verts) { if (!IsActive()) { return; } if (targetVertices == null) { return; } if (targetVertices.Length == 0) { return; } for (int i = 0; i < verts.Count; ++i) { if (targetVertices[i % targetVertices.Length]) { var vert = verts[i]; vert.color = color; verts[i] = vert; } } } } }