can you use set visibility (scene component) to set the visibility of a widget component

hi

can you use set visibility (scene component) to set the visibility of a widget component or must you use set visibility (widget)
the latter requires a cast from the widget component to its base widget to get it to build
it seems i cant get the former to work

thanks

No, a scene component is not related to a widget.

You should not need the upcast, though; every method on a base class is already available on a subclass

1 Like

you cant plug in a widget component into set visibility (widget)
that is why i used a cast - to get from the widget component to a widget in order to use set visibility (widget)

this dont work?

1 Like

yes that is what i am doing
and yes it works

my initial question is whether one can use set visibility (scene component) to set a widget component’s visibility seeing that a widget component is also a scene component and you can actually plug a widget component into a set visibility (scene component) node

but seemingly one can not, based on the replies so far and the results i get

Sorry, I think you were saying something about casting.
But are you sure “hidden in game” doesn’t work? I’m pretty sure it should.

1 Like

by casting i mean transitioning from widget component to widget with the appropriate node (get widget)

if i use set visibility (scene component) and plug a widget component into it, it does not seem to work
have not tried set hidden in game for this -
think it is perhaps easier to stick to widget component → widget → set visibility (widget) than playing around with set visibility (scene component)

Well, you shouldn’t use Visibility for gameplay. It’s for editor time. For gameplay, you just have to use “hidden in game.” But it should still work.

I’m starting to doubt I understand your problem, haha. Because you’ve made me doubt so much that I tested it and it works.

1 Like

lol

objective was not to get you to doubt

what do you mean set visibility is only for editor
will it not work in gameplay
it works when i simulate so that is why i never worried about using it

thanks seems set hidden (scene component) can be used apart from set visibility (widget) apart for your gameplay comment

Visibility of course work, But…

Normally, Visibility is used in the editor and hidden in-game for gameplay.
This is because, for example, when you’re in the editor, you want to see the lines that have a trigger or an arrow. But you don’t want them to appear while you’re playing.
Or you want to see an object in the scene, but when the game starts, it’s hidden. Without these two variables you would have to choose between adding additional code when the game starts, or not seeing the objects while you work, or even remembering to change the visibility every time you work with the object.

It’s a matter of getting used to using “hidden in game” and you’ll avoid confusion. “This is the way.”

1 Like