Skip to content

Instantly share code, notes, and snippets.

@DenL
Created May 15, 2015 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DenL/8f1f33c27d4bcf1d86a1 to your computer and use it in GitHub Desktop.
Save DenL/8f1f33c27d4bcf1d86a1 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
namespace MochiLabs.UI.Effects {
[AddComponentMenu("UI/Effects/Tint")]
public class Tint : BaseVertexEffect {
[SerializeField]
private Color32 tintColor = new Color32(225,225,225,255);
public override void ModifyVertices(List<UIVertex> vertexList) {
if (!IsActive())
return;
int count = vertexList.Count;
for (int i = 0; i < count; i++) {
UIVertex uiVertex = vertexList[i];
uiVertex.color = (Color)uiVertex.color * (Color)tintColor;
vertexList[i] = uiVertex;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment