SetColors(Color, Color)
Set the line color at the start and at the end.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public void SetColors(Color start, Color end)
Parameters
Examples
using UnityEngine;public class Example : MonoBehaviour{ // Adds a lineRenderer to this transform and // makes the line renderer fade at the end. Color c1 = Color.white; Color c2 = new Color(1, 1, 1, 0); void Start() { LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Sprites/Default")); lineRenderer.SetColors(c1, c2); }}