我地想做出Dynamite text box可以scroll 效果

首先生一個panel出來,調好大小(尼個大小會係你最後顯示出尼既大小),再生一個UI.text出尼,然後將UI.text拉入去panel內

調一下UI.text的大小,最好大於panel方便測試scrolling

然後,去panel加入<mask>同<scroll Rect>,mask 主要用尼cover左出血既位,scroll rect是用scroll,Content選擇text

然後用script計算出textbox既size

public RectTransform rt;
public Text txt;

void Update () {
        rt.sizeDelta = new Vector2(rt.rect.width, txt.preferredHeight);
}

トラックバック

このブログ記事に対するトラックバックURL:

コメント & トラックバック

No comments yet.

Comment feed

コメントする

Smiley face

April 2024
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930