x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

show hide actor

hi, i'm trying to show and hide actor (widget) on line trace. It works, but when it's hide i can't show it anymore. Does anyone know how to fix it ? thanks in advance.alt text

Product Version: UE 4.18
Tags:
showhide.png (173.2 kB)
more ▼

asked Jan 17 '18 at 12:29 PM in Blueprint Scripting

avatar image

kishindba
6 2 5 8

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first
more ▼

answered Jan 17 '18 at 12:35 PM

avatar image

vr_marco
2.2k 10 6 12

avatar image kishindba Jan 17 '18 at 12:39 PM

I've also tried set visibility, but it doesn't work ((

avatar image vr_marco Jan 17 '18 at 12:40 PM

Can you show how you toggle the visibility of the widget? The screen shot above doesn't show the full interaction.

avatar image kishindba Jan 17 '18 at 01:17 PM

i'm new in UE and maybe i did something wrong. but i tried a lot of ways with visibility ((alt text

visibility.png (253.7 kB)
avatar image vr_marco Jan 17 '18 at 07:39 PM

I am a bit confused by your logic. Can you make it simpler just to make sure it works?

Make one key, say F, that spawns the Widget. One key, say G, that does Set Visibility to true and finally another key, say H, that Set Visibility to false. In this way you separate the effects of the different keys and you know it is working, then you can gradually go back to your solution.

avatar image kishindba Jan 18 '18 at 10:39 AM

yes, sorry. i did like u said, (if i understood u correctly) but it doesn t work.. alt text

hideshow.png (261.1 kB)
avatar image vr_marco Jan 18 '18 at 10:44 AM

I am puzzled by the way you create your widget to start with. Usually this is done with Create Widget and then Add to Viewport. Does your Widget show up at all when you press F?

avatar image kishindba Jan 18 '18 at 10:47 AM

yes the widget is spawned. I actually added it to actor and then spawn this actor.alt text

spawn.png (96.9 kB)
avatar image vr_marco Jan 18 '18 at 10:53 AM

Ah got it! So your Widget is actually inside an actor blueprint. Now it is clear. In fact I tracked down a similar issue that was pointed out for 4.10. Still marked as unresolved. Can you have a look if this is your case? They may be related.

https://issues.unrealengine.com/issue/UE-26114

avatar image kishindba Jan 18 '18 at 11:01 AM

yes, this is the same as my issue. So its kind of bug ? :S maybe,.. can i get widget component and use set visibility for this ?

avatar image kishindba Jan 18 '18 at 11:04 AM

as i need to show widget when i trace some object and press trigger, then hide it with trigger again..but this actor has already there from the beginning..

avatar image vr_marco Jan 18 '18 at 11:54 AM

Yes, seems like a bug, but it only seems to affect widgets as components inside actors.

If you need to just show the widget on the screen, then you can use Create Widget and then Add to Viewport. In this way hiding and showing it should work.

I cannot think of any other workaround to your issue.

avatar image kishindba Jan 18 '18 at 12:36 PM

I also did it, but then i couldn't use widget interaction as my project in VR. so i could't use controllers.

avatar image vr_marco Jan 18 '18 at 12:42 PM

Apparently there are a couple of workarounds available. Check here:

https://answers.unrealengine.com/questions/222787/3d-widget-not-hiding-bug.html?sort=oldest

avatar image kishindba Jan 18 '18 at 12:50 PM

wow , it looks like i can use it. Thank you so much

avatar image vr_marco Jan 18 '18 at 12:54 PM

Curious to know if it works for you as well. Keep me posted! :-)

(comments are locked)
10|2000 characters needed characters left

A few comments:

  • avoid using flipflop as you don't really know what is the first state of your variable, this can be a source of confusion

  • to keep your code/BP clean, your flipflop should only call SetVisibility(), not SpawnWidget... which is another kind of logic and should be dealt elsewhere

  • the set SetVisibility in the lower part of your screenshot is applied to a WidgetActorRef->RootComponent which is undefined for us.. I presume it is created and correctly set by SpawnWidget ?

  • do you need to change the visibility of the RootComponent ? or do you to change the Visibility of the WidgetActorRef itself ?

One solution to your problem: put the SetVisibility(true) node AFTER calling the SpawnWidget (in your screenshot, you are setting the visibility to true... then spawning the widget)

More proper solution: you should Spawn the Widget elsewhere (beginplay ?) and just change the Visibility to true or false after. There is always a cost to spawn Widgets and Actors and it should be done only when necesary

more ▼

answered Jan 17 '18 at 10:04 PM

avatar image

lpalbou
176 3 11 16

avatar image kishindba Jan 18 '18 at 12:41 PM

thank you, your advice is very useful. But it seems like a bug, so i cant hide/show actor with widget component...

(comments are locked)
10|2000 characters needed characters left

I don't think there is a bug. Here is a screenshot on how to achieve what you want on a Character Blueprint (could be done elsewhere)

alt text

In this example, the EventTick is there to perform the line trace each frame, so that when your character is in front of an ActorWidget, it selects it and keep a reference in SelectedActorWidget.

In a second step, once an ActorWidget has been selected with your LineTrace, in this example you can Toggle the ActorVisibility visibility with the F Key. It works both to show and hide the actor.

Rather than performing a LineTrace at each Tick to select the ActorWidget, you could do one LineTrace for instance when the User is triggering a key, mouse or motioncontroller button.

more ▼

answered Jan 19 '18 at 11:41 PM

avatar image

lpalbou
176 3 11 16

avatar image kishindba Jan 24 '18 at 11:01 AM

Thank you. toggle visibility works. :))

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question