Hey, does anyone have any clue why sometimes the widget material is not applying?

It keeps black like in this screenshot. It eventually come back working if I remove and re-add to my hand slots. Any clue?
No description
Solution:
you need to re-initialize render target on equip
Jump to solution
19 Replies
Marcio Neves
Marcio NevesOP•2mo ago
No description
Robb
Robb•2mo ago
not sure, @SirDigby {Mod Name} did you encounter this with Digby Tool at all? there have been some pretty big changes to equipment actors this version, check the updating guide for more info. maybe it's getting disposed at a bad time or something
Marcio Neves
Marcio NevesOP•2mo ago
That's how I apply the widget as a material in all my equipments and buildings, now. For some I do at BeginPlay, for others that use multiple different widgets I switch from one to the other according to the target being aimed (like in Settings Copier). It used to be a floating widget within the equipment, but it had issues with different FOVs, so I used this solution, that someone taught me a long time ago
No description
Marcio Neves
Marcio NevesOP•2mo ago
It eventualy work, but I have to unquip and equipe a few times to make it being displayed maybe some "race condition"?
Robb
Robb•2mo ago
what if you run it again on equip and not just on begin play?
Marcio Neves
Marcio NevesOP•2mo ago
hmm I will try that but, it wouldn't explain the ones that change all the time, like the Copier, where it changes the widget according to what is being aimed, if machines, signs or trains Same with mass upgrade, with belts, pipes or poles
Marcio Neves
Marcio NevesOP•2mo ago
And I also run it with a delay, maybe because it would not work properly already right away 🤔
No description
Robb
Robb•2mo ago
can you add some code to debug, ex. prints saying what the material instance is while it's held? I wonder if the material instance is getting unset or if it's still set but erroring somehow
Marcio Neves
Marcio NevesOP•2mo ago
I will try that, just have to find a way to not overload the log 😅
Marcio Neves
Marcio NevesOP•2mo ago
Hmm... it returns None for the Get Render Target, at first. Curious 🤔
No description
Marcio Neves
Marcio NevesOP•2mo ago
Maybe I should keep checking each tick until it no longer returns None... or increase the delay 🤔 But that still does not explain why the ones that change according to what I am aiming doesn't work, also, unless I unequipe and re-equip one or more times until it start working found a way around. Not perfect, but it works, now I incresed the timeout to 2s, and also added its setup to OnEquip, with the 2s delay, too
SirDigby
SirDigby•2mo ago
The Digby Tool didn't use a widget, so I'm no help here
Rex
Rex•2mo ago
Ah right, I think you used a material with a render target?
SirDigby
SirDigby•2mo ago
Yeah. Tried to copy what the vanilla object scanner uses
Robb
Robb•2mo ago
powersuit's hoverpack controllers will probably run into this but I haven't looked into it yet
Archengius
Archengius•2mo ago
object scanner has been rewritten
Solution
Archengius
Archengius•2mo ago
you need to re-initialize render target on equip
Marcio Neves
Marcio NevesOP•2mo ago
Yeah, that kinda did the trick I used to do it only at BeginPlay (for single screen ones like Efficiency Checker ans Mass Upgrade). I also got issues with Settings Copier, but It was because the default screen would not initialize properly, and it is kept selected until some different building type is aimed, like Signs or Trains
Archengius
Archengius•2mo ago
If you guys are using object scanner as a template for an equipment with a widget I could give you the .cpp implementation of it so you don't have to actually inherit it for things that are not object scanner
Want results from more Discord servers?
Add your server