I have 2 blueprints that are based on C++ Widget class i created with an event “WidgetControllerSet”
- WBP_Orb_Master
- WBP_Orb_Health
Orb master has an Image component - the image is set to a material instance which has a set of parameter values. One being percentage. The percentage empties/fills the globe.
When I set scalar parameter value in event pre construct or event tick, the globe parameter appears to be set properly to 0 but if i do it in my Event WidgetControllerSet, then it doesnt work at all and appears at whatever default value the MI has
Am i doing something wrong?
Hey,
When do you call the Widget Controller Set? Is that before or after PreConstruct?
Also do you get any errors when you play using the WidgetControllerSet method? These should pop up via the message log when you stop PIE
So, Im not sure i know the answer to your question, im not fully understanding events,delegates,and their nuances.
I did confirm however that widgetcontrollerset is working, just not for the initial broadcast setting of the value.
If pickup a health potion for example, i can see the material param get set and change.
I do however need to also call it in preconstruct if i want that initial value to be set… Why this is, i have no clue, considering that i can see the material instance in the breakpoint, and the widgetcontrollerset breakpoint gets hit first.
So to confirm your seeing the widgetcontrollerset get called before PreConstruct but the SetScalarParameter doesn’t work here. Then PreConstruct gets called where it does work, then later in the game the WidgetControllerSet gets called and works fine?
Is there a reason you don’t default the Material Instance Parameter to 0 anyway to save having to set it at the beginning each time?
Yes that is exactly what im seeing happen - very strange.
And yeah I think I could default it 1.0 so that the health globe is at 100% initially.
Just some more info -
This is the very first thing that breaks.
The thing is, i dont think the orb is even on the screen at this point - i think that somehow a c++ class might be setting and triggering the event before “the material is ready to be changed” so this initial setting of the values from the gameplay effect doesnt do anything.
Then it happens again with the same values in event pre construct but somehow the material is ready to be updated or something.
heres my classes if ur curious
HUD initing the overlay (this happens when the character is possessed)
Okay as it turns out im just an idiot that has been looking at stuff for too long.
I was settings the Orb Dynamic Material Instance variable in event pre-construct… so when i used that in the first event getting triggered, there was no DMI found.
this works
1 Like