Why isn't my widget visible when added?

Follow the breadcrumbs, at this point I’d actually blame the references. Either the Hud or the NPC.

The panel is nested inside a canvas which is part of a widget switcher, I know the add child is firing cause a breakpoint says so. It’s just not visible? There is nothing to “anchor” as the widget it’s adding has a size box not a canvas.

Things to consider:

  • visibility of the Canvas Panel 1
  • visibility of the the NPC Hud
  • visibility of the widget you’re creating
  • you mention a switcher - is the correct index selected? Only the selected one is shown.

Hard to tell what else could be wrong from the info posted.

Yes to all, cause the button that actually makes that pop up would require that the switcher is on the correct canvas panel. And the canvas panel it’s adding to is that one.

Also dude your everywhere.

Oh, I live here.


Can you Print String the Return Value of Add Child?

It is infact returning “none”

Okay for some reason the canvas it’s trying to add too is not valid.

Well I couldn’t do a get through the placer controller or anything as the hud I’m referencing is the npc’s hud.

Cause I mean looking at it there’s no obvious reason the ref shouldn’t work.

Does it work, though? Is the NPC BP Ref valid in the first place? No one can tell by just looking at the attached image. Think about how and when you set the reference.

You should be seeing access none errors in the log.

I mean as far as I can tell it’s the npc that is invalid which makes all the others invalid. I just don’t get how the npc is ref is invalid though cause its just a simple ref.

Can you show a screenshot of you setting the reference? Or at least explain how and when it is Set. Also, the order in which blueprints initialise is somewhat convoluted and certain things may need to be done in specific order. It is probably not the case here, though.

Essentially, how does this widget know what the NPC variable points at? You exposed it on spawn? Or set via an event? Something external feeds the widget data?

Again, how did you set the NPC variable? Creating a variable is not enough, it’s just an empty pointer. You still to need to point it an object instance.

It’s just a variable of type npcbp, the npc’s huds are set in that bp so. Npc_BP > Npc hud > hud canvas

I don’t understand?

You create variable and choose it’s type, that is the setting. If that’s incorrect then lots of my functionality on the npcs hud shouldn’t be working at all. But ti is. I’m pulling the npc ref the same way I always do for everything else.

You create variable and choose it’s
type, that is the setting.

No, this is creating a null pointer and this is precisely why this is not working and never will. You can test it easily by creating an object variable in any blueprint and printing its value - it will always be invalid.


In the image above you Expose on Spawn - if you go to the Create Widget node owning the button of the Event we see in the original pic, you’ll notice an an extra pin there - feed it data is one way you can set the reference. Is anything plugged into that pin?

The widget that is trying to add the child is a widget that is put into the main npc-hud as a user created widget, just a button with a border and text.

The owning player is just my player controller other then that there are no extra pins on it to be seen.

The widget that is trying to add the
child is a widget that is put into the
main npc-hud as a user created widget,
just a button with a border and text.

Then it definitely does not have the reference set up properly unless you do it somewhere during widget construction, but we cannot see it here.

The NPC BP Ref we see in the original photo is invalid because you never assigned it any value, you just created a variable which is empty. It’s, kind of, like creating a text variable with no text… Yeah, the variable is there but it has no value - not the best example but should give you the idea.

Imagine what happens if you have 10 NPCs in your game - how is this widget supposed to know which one you mean - you need to point it at the object.

Btw, consider opening the output log, you should be seeing Access None errors - a good indication things are not working.

I mean I believe you and I genuinely appreciate the insane amount of help thus far. You definitely know what your talking about and I’m a noob.

But uhh my output log is blank. Buuut the print strings hooked up to an isvalid are still returning that the npcbp ref is invalid. So you are correct.

And no I don’t do anything from widget construction, and my huds variables just change depending on who’s getting selected nothing is actually being saved.

Yup, now we can see more.

Notice how you actually set references - the Controller Ref and the NPC HUD ref. Not only do you have a variable, but you actually Set it! You also set one via an exposed pin - the NPC Ref. That’s cool and this will work.

Now you need to find a place where you can set the NPC BP Ref the same way.


You mentioned this widget is manually added as a user widget, right?

The widget that is trying to add the
child is a widget that is put into the
main npc-hud as a user created widget,
just a button with a border and text.

Does the widget that owns those user widgets have a valid NPC BP reference you can use?

Hmm hmm indeed it does.

The widgets are in the npc ref and its variables are setup by just calling to the npc bp so, get hud ref > get npc bp > hud again? > then canvas >

Cause I’m just trying to make it so this scrollbox widget will show up when you click on the slots here.

If the NPC BP reference was passed via Exposed on Spawn - in the Event Construct, make an array out of those user widgets and then For Each Loop and Set each element’s NPC BP Ref to NPC BP.