今回は某ゴミ言語ではなくC#で書きますよ。
Panel作成機能で作った”Panel”の子へ”LoadingScript”GameObject
さらにその子に”OriginalLabel”GameObject
LoadingScriptにはこのスクリプトを貼ってね。
→ 修正したgistURL: https://gist.github.com/shinriyo/8621249
using UnityEngine; using System.Collections; public class LoadingScript : MonoBehaviour { public string WORD = "NOW LOADING..."; public float HEIGHT = 30; public float SPEED = 160; public float DELTA_X = 25; public float TIME_DELTA = 30; public Vector3 WORD_SIZE = new Vector3 (28, 28, 1); private int _stringSize; private bool _endFlg = false; private Transform[] labelArray; void Awake () { _stringSize = WORD.Length; labelArray = new Transform[_stringSize]; for (int i=0; i<_stringSize; i++) { Transform trans = transform.Find ("OriginalLabel"); GameObject go = NGUITools.AddChild (gameObject, trans.gameObject); go.name = i.ToString () + "Label"; go.transform.localScale = WORD_SIZE; go.transform.localPosition = new Vector3 (i * DELTA_X, 0, -1); UILabel uILabel = go.transform.GetComponent<UILabel> (); uILabel.text = WORD.Substring (i, 1); uILabel.depth = 1; labelArray [i] = go.transform; } } // Use this for initialization IEnumerator Start () { yield return new WaitForSeconds(3.0f); _endFlg = true; } // Update is called once per frame void Update () { float rad = Time.time * SPEED % 360; for (int i=0; i<_stringSize; i++) { float yPos = Mathf.Sin ((rad - i * TIME_DELTA) * Mathf.Deg2Rad) * HEIGHT; if (yPos < 0) { yPos = 0; } labelArray [i].localPosition = new Vector3(labelArray [i].localPosition.x,yPos,-1); } } }
↑これはOriginalLabelをコピーしてそれに文字を流し込むよ。