TWeakObjectPtr compile error: UWidgetComponent is not a UObject?
1) Create MyActorComponent Class
2) Include "UMG" in the *.Build.cs file
3) Add the following line to your MyActorComponent.h
Trying to compile will result in an error, that "TWeakObjectPtr can only be constructed with UObject types".
Setting the default value in the constructor instead of the header file does not result in a compiler error.* Another possible solution is including "Components/WidgetComponent.h" in the header file, which I wouldn't recommend if you don't understand circular dependency.
o I guess it is a bad practice to set the default value in the header file. But the behaviour is definately inconsistent, as the following line would not result in a compiler error. That's why I thought I would share my findings.
Full Compiler Error Log for Google:
This error can apper also then you put undefined type or incomplete type where compiler does not know the size of stricture (or rether your forward reference declertion does not inherent UObject)
So it is something wrong with forward refrence
Follow this question
Once you sign in you will be able to subscribe for any updates here