Skip to content

Text (JavaScript) ​

Text ​

Scripting Name:Insight.Text

GUI 上文本组件。

Properties ​


color ​

type :Insight.Vector4

文本颜色。

javascript
// sample:
var text = gameobject.getComponent("Text", 0);text.color = Insight.Vector4.New(1.0, 0.0, 0.0);  -- 将文本颜色改为红色

text ​

type :string

文本内容。

fontSize ​

type :number

字号。

material ​

type :Insight.Material

文本使用的材质。

Methods ​


toString ​

javascript
public string toString();

将 text 内容以一定格式转为 string 类型。

javascript
// sample:
var text = gameobject.getComponent("Text", 0);Insight.Debug.Log(text.toString());

Inherited Properties(继承自 Component) ​


enabled ​

type : boolean

该组件是否是可用的。

gameObject ​

type : Insight.GameObject

(只读)该组件所依附的 GameObject。

isActiveAndEnabled ​

type : boolean

(只读)该组件是否可用,且其依附的 GameObject 是否是活跃状态。

name ​

type : string

(只读)所依附的 GameObject 的名称。

tag ​

type : string

(只读)所依附的 GameObject 的 Tag。

⚠️ 暂时未启用

transform ​

type : Insight.Transform

(只读)所依附的 GameObject 的 transform。