用户工具

站点工具


侧边栏

script:unityengine:classes:textgenerator:textgenerator

TextGenerator 文本生成器

Namespace: UnityEngine

Description 描述

Class that can be used to generate text for rendering.
此类可以用于生成用于渲染的文本。

Caches vertices, character info, and line info for memory friendlyness.
缓存内存友好的顶点,字符信息和行信息。

JavaScript

var font : Font;
function Start () {
	var settings = new TextGenerationSettings();
	settings.anchor = TextAnchor.MiddleCenter; 
	settings.color = Color.red; 
	settings.extents = new Vector2(500f, 200f); 
	settings.pivot = Vector2.zero; 
	settings.richText = true; 
	settings.font = font; 
	settings.size = 32; 
	settings.style = FontStyle.Normal; 
	settings.wrapMode = TextWrapMode.Wrap;
 
	var generator = new TextGenerator();
	generator.Populate("I am a string", settings);
	Debug.Log("I generated: " + generator.vertexCount + " verts!"); 
}

C#

using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
    public Font font;
    void Start() {
        TextGenerationSettings settings = new TextGenerationSettings();
        settings.anchor = TextAnchor.MiddleCenter;
        settin
                    
                                    
script/unityengine/classes/textgenerator/textgenerator.txt · 最后更改: 2016/08/02 05:28 (外部编辑)