我地想做出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

June 2023
S M T W T F S
 123
45678910
11121314151617
18192021222324
252627282930