Created
March 2, 2019 09:12
-
-
Save unitycoder/f7ea9019bb67b7042efbd08f0f4fa785 to your computer and use it in GitHub Desktop.
Gradient Texture Maker Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requires this script: https://github.com/UnityCommunity/UnityLibrary/blob/master/Assets/Scripts/Texture/GradientTextureMaker.cs | |
using UnityEngine; | |
public class TestGradient : MonoBehaviour | |
{ | |
public Color[] colors; | |
public FilterMode filterMode = FilterMode.Point; | |
public TextureWrapMode wrapMode = TextureWrapMode.Clamp; | |
public bool isLinear = false; | |
public bool hasMipMap = false; | |
void Start() | |
{ | |
var mr = GetComponent<MeshRenderer>(); | |
// generate texture and assign as main texture | |
mr.material.mainTexture = UnityLibrary.GradientTextureMaker.Create(colors, wrapMode, filterMode, isLinear, hasMipMap); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment