蓝图使用ListView添加条目的问题

688 阅读1分钟
  • 问题:使用UHDListView AddItem时,启用Expose on Spawn的变量,在CreateWidget时并没能把值(例子中的Quest)传给Entry(例子中的QuestListBase),导致不能在外面更新list条目的数据。
  • 分析:
    • EntryEvent Construct是在AddChild之后触发,这时外层创建的Entry Widget数据已经为传入的值,但是Event Construct输出的值确还是default value.
    • 外层AddChild等待2秒后输出的Quests数据仍然跟EntryEvent Construct中输出的数据不一样(所以他们各自独立?)
  • 推测:创建Widget(有外层输入),在作为条目被AddChild后列表又重新generate了条目(这里没有外层的输入),所以是两个不相干的instance
  • 解决方案:
    • 不使用ListView情况下使用AddChild(不会重新generate)
    • 使用ListView情况下使用Construct Object from Class,在指定的Class中Class Settings添加Interface:User Object List Entry,获得事件Event On List Item Object Set,然后可以把输入值应用到相应的变量上。