How to keep the checkbox state

I want to turn on / off the shadow of the static mesh using Level Varinat Set and Widget BP, but when I turn it off and close Widget BP, access Widget BP again, the checkbox is not turned off.
I don’t know how to keep the checkbox state correctly.
Please tell me in an easy-to-understand image. I’m a non-game user, so I’m not familiar with blueprints.

but when I turn it off and close
Widget BP, access Widget BP again

Could it be that rather than opening / closing the widget, you create and destroy it instead? In this case the widget will not remember its previous state since it’s not the same widget…

Above we see All Widgets getting removed from the viewport. Could you then elaborate on how the widget that is supposed to hold the Checkbox state created and shown?

access Widget BP again

How is this particular thing done?

I’m making a very simple blueprint. Don’t think hard. (But it’s difficult for me …)
It’s like turning the lights on and off. I would like to operate only with “checkbox” which is not in the general tutorial.

Should “Remove All Widget” be “Remove from Parent”?
The reason for closing the Widget BP is simply to return to gameplay with the shadow off.
Even if I close the checkbox in the off state, I want it to be reproduced in the off state the next time I open it. Of course, if I close it “on”, the “checkbox” must be “on”.

The shadow of the mesh is “on” at the start of the game. So “Checked State” is “on”.

When I open this widget BP again to turn shadow “on”,the “checkbox” is already “on”. If I click twice, the shadow will turn on, but that’s a bad specification.
I have to store the state of the “checkbox” in something? You think that it is necessary to use the stored information to reproduce the on / off state?

Is the explanation enough? Please tell me if it is still insufficient. Thank you very much.

When I open this widget BP again to

Could you just show how you do this, that’s all.

1: GameStart
2: I want to turn off the shadow of the mesh
3: I opened this Widget BP
4: I can consider turning the shadow on and off using the checkbox
5: I turn off the “checkbox” and close this Widget BP
6: Shadow turned off when I returned to the game
7: But I still want to turn off the shadow
8: Open this widget BP again
9: Unfortunately the checkbox is “on” (not “off”)
10: I click the checkbox twice Then the shadow will be turned on

Why do I need to click twice?
If the checkbox is “off”, should only need one click.
Thank you.

7: But I still want to turn off the shadow
7: But I still want to turn on the shadow

I opened this Widget BP

Could you please just post a screenshot of this? How is this widget created and added to the screen?

Sorry, but this is really confusing at this point…

This depends on whether or not it is multiplayer, if it is not store a variable in the Gamemode called Shadow Off or something that is a bool, and when you click the button Get Gamemode/Cast to Your Gamemode, and set the value to on. If it is multiplayer you want to save the value in the GameState.

Game start

Widget First open

Turn off widget

Wiget second open(After I turn off the “checkbox” and close this Widget BP)

Sorry, mate. But that’s really not what I meant. We really need to know how this widget is added to the screen.

  • do you create widget → Add to Screen
  • do you use a widget component?

Game start

You say this, but I was really hoping for a screenshot of how this widget is added to the screen. You’re showing a scene of with the widget already in the scene. That does not really help much.

Widget First open

Again, how do you open the widget after removing it.

If you read OP’s post, you’ll see they’re not making a game - unlikely for it to be multiplayer. I’m under the impression that when they show a new widget, they simply create a brand new widget. So there’s no data retention whatsoever…

What you’re you suggesting would, of course, work but it seem redundant for something as simple as keeping a checkbox checked.

It’s pretty mych impossible to tell what’s going on judging by what was posted so far; normally one would:

So rather than creating a brand new widget, you’d show the one you had so its values remain intact. And you you remove all widgets, you can still re-add that you already have. So it’s checkbox stays as it was.

Perfect. It’s precisely what I thought. I’ll post a solution in a bit.

Is this all right?
I am using the FirstPersonTemplate by editting it.

I want to turn on / off the shadow of
the static mesh using Level Varinat
Set and Widget BP, but when I turn it
off and close Widget BP, access Widget
BP again, the checkbox is not turned
off.

For this issue:

  • and the widget button closes like so:

Image from Gyazo

And you can copy the script from here:


And if you need the widget to be closed with Tab (instead or in addition to closing it with a button, that’s a bit more involved but perfectly doable!). Do tell how it goes.

Good luck!

Excellent!
It went well! The “checkbox state” has been kept!

Although visual scripting is convenient, it’s difficult for me because I wasn’t involved in programming work.
I searched on google for about 3 weeks, but I couldn’t solve it.

I still have a lot of work to do.
TimeOfDay, and More.
I want to combine these with this ShadowWidget.
I hope it will work.

I still have a long way to go.

Thank you very much. I really appreciate it.

The engine is a complex beast, indeed!

TimeOfDay

Bind this to the text box:

347296-screenshot-4.png

347294-screenshot-3.png

347293-screenshot-2.png

It helps me a lot.
This is a SunSky widget.
Replace the light switch turn on off with “checkbox” :smiley: