Question about using MVVM.

Hi,

We’ve been looking into the UMG Viewmodel and have a couple of questions.

  1. The Epic docs warn this is Beta feature. Are there future plans to make this a fully-featured and supported part of Unreal Engine. Is there a roadmap available?
  2. The doc says arrays “are not normally accessible”. However, in the Unreal Fest 2023 video that introduces UMG Viewmodels the example shown (at the 8:40 mark) looks like it has a collection of viewmodels (see pic). Are there plans to support arrays or collections in the future? An observable collection that notified us of individual changes to a collection would be helpful.
  3. Our UI team is concerned about performance given that every FieldNotify property on a Viewmodel is a dynamic multicast delegate. Imagine a UI screen that has dozens of view models in it with ten FieldNotify properties each. Is there any feedback you have regarding performance?

Please see attached screenshot.

Thanks,

PBP Engineer

Hi,

Answers to your questions below:

1. It’s being actively used in Fortnite and elsewhere so the plan is to continue supporting/developing it, though you may still run into the occasional issue. We don’t have an exact roadmap or timeline on when the plugin will leave beta, but if you encounter problems (or have specific feature requests), feel free to post a ticket and we’ll investigate.

2. You can’t bind to array members, nor will a bound array automatically broadcast when members are added/removed, but you can bind an array and manually broadcast. We support this with things like ListView, and even recently added support for basic panel types like horizontal/vertical panels. The idea is that you make one ViewModel (i.e. MyListViewVM) that holds the array of members (i.e. MyListIemVM), where each member represents one item in the list. You then add the Item VM to the Item widget and bind fields, and add the ListView VM to the widget containing the ListView, binding it to SetListItems. You won’t get automatic notifications when items are added/removed from the array, but you can manually broadcast a field value change when that happens and things will update properly. Let me know if that’s unclear and I can put together an example.

3. We haven’t heard any performance concerns yet, though we’d be interested to hear if you encounter any. I know of some projects where there are dozens/hundreds of viewmodels at once, scenarios such as using a view model for each enemy to hold it’s current stats or using a TileView to display a huge inventory where each item is backed by a viewmodel. Typically the actual work being done when a FieldNotify property changes is fairly negligible compared to the resulting UI invalidation (if using invalidation), though an Insights trace will give a better idea of the impact in your specific scenario.

Best,

Cody

Hi Cody,

Thank you for the info that helps a lot.

Best,

Simon