Need help creating a DefaultSubObject of a widget Component Blueprint
Hi, I'm making an RPG, and I am trying to create a widget component in c++ based off of a WidgetComponent Blueprint, but I keep creating Nullptrs and crashing my editor.Here is what my code currently looks like in my PowerEntity.cpp (parent c++ class of all my entities):
First problem is that the editor is not finding the blueprint at the specified path that I copied directly from, and I get this error:
I also tried setting the FObjectFinder class to UClass, and casting NameplateReference as UNameplateController, and while NameplateReference had a value, NameplateController was null after setting it equal to the casted NameplateReference.Object.
I've been trying to fix this for days, and I've looked at so many threads, and nothing seems to be working. I would really really appreciate it if someone took some time to help me resolve this.
Is NameplateController a WidgetComponent pointer?
If so, you should use the CreateDefaultSubobject() function to create a new actor component.
You should also use FClassFinder to get the TSubclassOf for your blueprintclass. Then use the .Get() function to get the UClass which you can pass into your CreateDefaultSubobject function.
~ Dennis / MazyModz
Follow this question
Once you sign in you will be able to subscribe for any updates here