Set Hidden in Game Not Working

I’ve looked everywhere and can’t seem to find a solution, and I don’t understand what could possibly be wrong. So hoping someone can help me here.

I have an icon that shows over things like pickup-ables and interactable NPCs and such, showing when you get close, going away when you walk away. It works for all of my item actors, such as apples, chests, etc. But I went to set it up (identically!) for the interactable NPCs and suddenly it’s not working, despite being done the same way as the other actors. Is it because it’s a character blueprint? Is there something else I have to do?

Here’s the code I’m using to show and hide it (which works on the other actors):

Collision settings are the same too (both components most have overlap collisions) on your sphere and generate overlap events is checked?

Overlap all dynamic is set (tried just overlap all, also didn’t work), and generate overlap events is checked. Still not working :frowning:

You used OverlapAll on BOTH components that are interacting? Asking because OverlapAll is a default preset. It won’t work if the other component uses custom collision settings/presets.

Only other things I can think of that would affect this are:

  1. Physical placement of the sphere (too high or too low, make them visible to be sure they are intersecting)
  2. One of the components is missing simple collision mesh.

Overlap All on both still does not work either unfortunately.

Spheres are definitely touching and set up properly, I used debug on starting overlap and leaving overlap to print if its in or out of overlap and it was showing as true/false as if it was working. Looking in the viewport of each, the spheres are large enough and sitting in the middle, they should be fine.

It is definitely overlapping, the code is firing off and setting off the debug command but it won’t actually turn it to ‘visible’ when overlapping.

edit

Sorry, to add, they both have a simple collision mesh as it comes with ‘character’ bp by default, so they definitely both have it…

edit 2

Starting to wonder if it’s something wrong with the widget. Thought I set it up the same as the other interact widget though… (item interact widget and npc interact widget images are slightly different so I needed 2 widgets)

edit 3

Sorry for so many edits I figure its better than re-posting… anyway not an issue with the widget. Copied the widget that was working and replaced the image to make the widget, reset it in the npc bp and still having issues.

Okay I felt this needed a post instead of an edit;

In frustration I created a copy of one of my actor BPs with a working hide/show widget when getting close/leaving collision. Got rid of the mesh so it was just the widget, but kept everything else and set it on top of the NPC (removing the NPC’s sphere collision just in case). Essentially I made the simple actor bp the interaction instead.

Forgot to uncheck ‘visible’ and it started visible (as expected), and would hide/reappear properly no issue! Just like the bp it was a copy of.

Unchecked ‘visible’ to hide it by default and suddenly it won’t work anymore despite this being a copy of a functioning actor doing the exact same thing as this one.

I’m wondering if this is a bug now!

Edit

So I tried leaving it set to ‘visible’ by default, and hiding it with the same command on ‘begin play’. But it does not hide it at all, it is visible, and if I get close and leave again it disappears meaning the code is working. But it starts as visible and will not hide with the code regardless of what I do.

Edit 2

If I set ‘hidden in game’ as true AND ‘visible’ to true, then use begin play > set hidden in game to true, it works properly (hidden from the start, visible when I get close) ONLY for the actor I copied from the other working actor. If I copy this all onto the NPC, it does not hide at the start of play.

Visible should always be active, it is only used for the editor. you just have to use “hidden in game”
are you sure geting correct reference?
Can you show the hierarchy in the actor?
By the way, wouldn’t it be better if you used the visibility of the widget and not that of the object that contains it

Sorry for the late reply, was asleep!

Wasn’t aware about visible being editor only tutorials gave me a different impression (I was taught to hide it and use the code to change visibility. Great tutorial if it’s teaching me wrong! D:)

Anyway, even with visible set to true, the ‘set hidden’ is not working when used to hide it at the start of play, only when overlapping (Unless it’s not a character bp, then it works for some reason). If it’s a character bp that’s when it refuses to hide at the start of play. With ‘visible’ set to true, I can get it hiding and reappearing when overlapping finally but I cannot get it to hide at start of play so it is always visible until the player overlaps it for the first time.

Here’s the NPC actor hierarchy:

I’m not sure how I could be getting wrong references given all references are inside the NPC actor BP and I’m dragging off the hierarchy (or click on them and typing the ‘begin overlap’ etc. so it grabs the reference to the sphere inside the actor and all that). I’ve re-grabbed from the list repeatedly to make sure I was referencing the right things, like I’m 100% sure the widget I’m referencing is in fact the one in the actor I’m trying to hide, given it does hide and show if I get near. It just won’t hide using ‘begin play’ now.

By the way, wouldn’t it be better if you used the visibility of the widget and not that of the object that contains it

I’m still fairly new so I’m not quite sure what the difference is here… sorry!

Edit
Just adding the two images of the code that’s working and code that’s not working:

Code that is WORKING inside a regular actor bp (excuse the branch, need it to not show if a quest isn’t active)

Code that is NOT working inside a ‘character’ bp (note: the hide and show on overlap IS working now, it’s the begin play that is not)

Edit 2

So messing around I found out the working code on the normal actor does not even need event begin play to hide it, as it has ‘hidden in game’ checked by default and actually does start hidden regardless, works no problem. But despite the same things set up on the npc ‘character’ bp, it will not hide the widget by default no matter what I do.

Maybe it’s not that, but you have the things inside the mesh and not the capsule. I’m making this up, but maybe the C++ code calls unhiden everything when the game starts. But hey, you shouldn’t worry too much, it’s not that weird to call hidden at begin play

By the way, if it’s a simple icon, wouldn’t it be better to use a bildboard?

I’ve always found widgets for icons like this a lot easier to work with than billboards from experience… in the long run it’s probably better but I prefer widgets for now :stuck_out_tongue:

Unfortunately it’s refusing to hide at the start of play regardless, so for now I’ve created a regular actor with just the widget, raised it high enough to be above the head when placed below it and used that to make a temporary icon for it. Dumb work around but it works at least.

For future readers; seems to be an issue with either just my character blueprint or character blueprints in general. Getting it to hide and appear works so long as ‘visible’ is checked, but if you’re working in a character blueprint it may not hide itself automatically. Make sure ‘hidden in game’ is checked and it may actually work for you. Otherwise, no solution has been found… sadly.