Hi! There were no changes when adding PROPERTY(). Daenerys_, asked to answer))
I’m guessing the global he’s refering to is that it’s defined in the header file. Not really global but rather class scoped.
As far as we know bCanDoMagic might be a reference to something anywhere that goes null. Can’t support without seeing everything.
it’s in the header file, the formatting is just screwed up (it’s in the normal text part, scroll it’s at 9 / 45 Dec 18).
Alright, that bool shouldn’t be the problem at all. I expect CastWidget to misbehave or be collected.
Not the case for datatypes other than UObject. Every UObject must be a UPROPERTY at least once at any time to not be collected. Other types like bool or float are not processed.
Maybe CastWidget is not initialized with CreateDefaultSubobject?
It’s only visible as class UUserWidget* CastWidget;
in the header but there is no code for it in the cdo of the magic component (at least the one posted in the initial posts).
Good one, it’s a normal pointer so it should be initialized as nullptr in the header, else it’s trouble.
UUserWidget* CastWidget = nullptr;
The thing is then set on BeginPlay.
My CTRL+F search has a hard time scanning older replies apparently.
Maybe that’s why it’s failing. It’s probably filled with random data causing the pure if(CastWidget) to pass positively.
Yeah, CastWidget was creating only in begin play and after some minutes he disappear and that was the problem
After initializing CastWidget as nullptr in the header and storing it as a UPROPERTY, any remaining issue?
No, problem was in CreateWidget in beginplay