WidgetComponent won't render in world
Hi everyone, I have created a Widget Component using C++ and attached it to a box trigger by creating it's default sub object in C++ for the Interactive portal I'm doing, the Widget component is supposed to show when ever a player character enters the bounds of the portal, but has shown on the GIF bellow, it is only possible to enable/show the image if I click on any property inside the details panel to redraw the widget...
I followed the answer show in this question: https://answers.unrealengine.com/questions/398335/widgetcomponent-not-visible-when-added-via-c.html, but the problem still persists and it's not shown.
The idea is to show this dpad image, but for some reason it's only showing the white screen and only if I cause a manual redraw by changing a property of the details panel.
some of the code I'm using is has follows and the main class that contains the Widget Component is a UActorComponent:
This is the BeginPlay of the Component: Super::BeginPlay();
And this is the code to actually render the Widget when the player enters the Box Trigger:
Update: Hey guys a little update, I have fixed the issue with the D-Pad Image not showing, I had set up the image in the Widget Blueprint has hidden, so it wasn't rendering correctly since I never changed it to visible in code, that has been fixed, but I can't still seem to be able to render it unless I go inside the details and update any property of the actor.
So I also added the request redraw, but it didn't work, it still needs me to manually update anything from the details panel to make it work.
Here are a couple of things that might help pinpoint the problem:
this is the Quickwatch after the request redraw: https://gyazo.com/c94ac5303204e9a876deaf77175dd888
and this is the thing I think is causing the problem: https://gyazo.com/8adb03d4477c4df6de3aedd97de9256c
I don't really understand why it's registering the component two times, once has if it where a child and another has a component when it should only add it has a component.
Hey guys, so I was able to finally get this to work, and the way I got it, was to initialize it when I start the BeginNotifyInteractive method on the overlap, So I basically did this:
Basically the problem came because I was trying to instantiate the Widget before the Component had begun play, so by doing this only the first time the player enters the trigger, I make sure that the Component has actually Begun play and it will be able to add the widget correctly.
Thank you and hope this helps someone else.
answered Sep 01 '18 at 09:48 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here