Skip to content

スクロールリストのコンテンツを更新する方法 #14

Answered by kyubuns
t5ujiri asked this question in Q&A
Discussion options

You must be logged in to vote

以下のような方法で更新が可能です。

// まず3個の要素を作って
using (var editor = ui.List.Edit())
{
    editor.Add(x =>
    {
        x.Text.text = "0行目";
    });

    editor.Add(x =>
    {
        x.Text.text = "1行目";
    });

    editor.Add(x =>
    {
        x.Text.text = "2行目";
    });
}

yield return new WaitForSeconds(1.0f);

// index = 1 の要素だけ書き換える
using (var editor = ui.List.Edit(EditMode.DontClear))
{
    editor.Contents[1] = new UIFactory<ListElements1>(x =>
    {
        x.Text.text = "1行目改";
    });
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kyubuns
Comment options

Answer selected by kyubuns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants