示例
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Test : MonoBehaviour { public CanvasRenderer canvasRenderer; public Color color; public Rect clipRect; void OnGUI() { //设置颜色 canvasRenderer.SetColor(color); //设置裁剪区域 canvasRenderer.EnableRectClipping(clipRect); } }