Hello,
For the better part of a week I’ve been exploring and learning the about the MVVM plugin for UE5.3. on the main branch of the engine and have encountered issues with overriding the UMVVMViewModelBase
class in C++ and experiencing issues with unhandled exceptions and corrupted BPs.
At first I wasn’t sure of what was causing the corruption but I believe I’ve gathered enough information to show reproduction steps for the error occurring on my end:
-
First step is to create an empty or template project with the MVVM plugin enabled.
-
Next override the
UMVVMViewModelBase
C++ class and add any variables with getters, setters or functions desired. (In my case I used the class provided in the Unreal Documentation page for MVVM). -
Run the project and create BP object from the overriden ViewModel class you just created and add it to any Widget and bind a function to a value (Again, in my case I used a widget with a progress bar and bound its percent value to the
GetHealthPercent
function in theUVMCharacterHealth
class provided above). -
Next is to create a reference to the VM BP anywhere in the code and add to the MVVM subsystem.
-
Going back to the overriden C++ VM class, create a a new variable, go to one of the created Getters, Setters or Functions you’ve made and replace the variable related to it with the one you just created.
-
Rebuild the project and Run it, notice that an exception is hit on the overriden VM C++ class and the VM BP is corrupted. (Live Coding also yielded the result sometimes but it was rare in comparison to just rebuilding the project).