返回介绍

GUI.color 颜色

发布于 2019-12-18 15:37:45 字数 1649 浏览 1097 评论 0 收藏 0

JavaScript => public static var color: Color;
C# => public static Color color;

Description 描述

Global tinting color for the GUI.

This will affect both backgrounds & text colors.

全局GUI染色,将影响背景和文本颜色。

Yellow Color on the GUI Controls.

GUI控件上应用黄色。

JavaScript:

	// Tints all GUI drawed elements with yellow.
	function OnGUI() {
		GUI.color = Color.yellow;
		GUI.Label (Rect (10, 10, 100, 20), "Hello World!");
		GUI.Box(Rect(10, 50, 50, 50), "A BOX");
		GUI.Button(Rect(10,110,70,30), "A button");
 
	}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    void OnGUI() {
        GUI.color = Color.yellow;
        GUI.Label(new Rect(10, 10, 100, 20), "Hello World!");
        GUI.Box(new Rect(10, 50, 50, 50), "A BOX");
        GUI.Button(new Rect(10, 110, 70, 30), "A button");
    }
}

gui

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文