GUI

PowenKo, Unity Tutorial 101-2, GUI, UTF-8 Font string display.

December 24, 2011   ·   0 Comments

Screen Shot 2011-12-24 at 12.03.44 AM

Screen Shot 2012-12-19 at 3.16.43 PM

#. create a  “GUI” folder

#. get a utf-8 font, like MSYH.ttf and copy to GUI folder

#. change Character to “unicode” and press Apply.

# create a new GUISkin and setup Font to your UTF-8 font.

# create a C# script

using UnityEngine;
using System.Collections;

public class MyGui : MonoBehaviour {
	public GUISkin myskin;
	public string t_s="www.powenko.com 这个脚本做的事很简单。先定义一个可设置的GUISkin...";
	// Use this for initialization
	void Start () {
	}
	void OnGUI(){

		if(myskin){
		GUI.skin=myskin;
		}

		GUI.Label(new Rect(0,0,400,400),t_s);
		GUI.Button(new Rect(0,300,200,30),t_s);
	}

	void Update () {

	}
}

#. create a Cube and add MyGui script
#. add our GUISkin_chinese to Myskin
#. add utf-8 string on T_s

#. run

sample code: unity_utf-8

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Unity3D4

Amazon

adsbygoogle

Recent Posts

Categories

Amazon