I have changed my user widget to soft class reference, but every time I open this project, viewmodel blueprints will lost its parent class, it is said that “Blueprints cannot load because it is derived from an invalid class. Check to make sure its paarent class has not been removed?“
Is your project c++ based? If so make sure to launch it from your IDE otherwise custom c++ classes will be broken on load.
Yes it is C++ based, I will try it later.
To my knowledge, it seems that you need to first create a widget and then build a view model in order for it to work properly
你是使用官方的那个逻辑吗
看官方文档和一些油管教程做的 用的global的那个加载方式
I made a test, create a new C++ project and add MVVM in blueprint, and save it, then it will error again on launching.
And BP project have no error on launching.
Does your c++ have the needed .h and .cpp file generated for your mvvm? (inherited from MVVM Base Viewmodel).
Sometimes the file can be put by default in the intermediate folder which is temporary. It can then be deleted when the project is regenerated on start.
If you are missing the c++ file then remake it in unreal and then open VM_Player MVVM blueprint and choose file => reparent blueprint and pick the c++ file. It should work ok.
I can’t find any file about VM_Player blueprint or MVVM in my project folder
If you want to use c++ for the base class the you have to create a new c++ class bassed on the mvvm base class I mentioned earlier.
It has to be where your other game related c++ files are (usually somewhere in the source folder of your game).
Once created you can then make a blueprint class of it.
Be sure ti check in vs or rider if the file shows up inside of your games source folder before shutting down the project.
If the file exists and us not in a temporary folder then it should work fine after closing and reloading.
Create new c++ class and bp class for mvvmgamesubsystem or viewmodel base class?
viewmodel base, that’s where your logic is going to go.
The subsystem should become valid in the engine once your project’s parent class is valid.
I create a c++ class MyMVVMViewModelBase_Derived derived from viewmodel base class and then create a bp class VM_C_Health derived from the c++ class MyMVVMViewModelBase_Derived, next time save it and reopen, mvvmgamesubsystem have no error but in Widget blueprint, I lost the binding.
Your health variable does not have a field notify in the new version.
if in c++ try declaring it with the needed property descriptors like for example:
UPROPERTY(EditAnywhere, BlueprintReadWrite, FieldNotify, Getter, Setter, BlueprintGetter="GetVisibility", BlueprintSetter="SetVisibility", Category="Behavior")
c++ tutorial on notifies not on the forum:
No, I had set it FieldNotify, now the problem is widget blueprint will lost binding to viewmodel blueprint after launch.
Do I need create a c++ class and a bp class derived from user widget base class like that above?
Not because FieldNotify, now the mvvmgamesubsystem had fixed but widget lost bindings with viewmodels while opening project.
OK It solved, but I don’t know why










