I press CAPS LOCK and it draws my new UI. I then check one of the checkboxes and it executes the console command assigned and draws some text on the screen to confirm.
If I CAPS LOCK again, the UI closes… that’s fine. But when I re-open the UI, the checkbox has reverted to unchecked.
I’ve tried adding SetCheckedState -> to “checked” in the blueprint both before and after the functionality of the checkbox but to no avail.
Anyone got any ideas? I’ve probably overlooked something simple.
I think I’m in over my head here. :-/ I’m not a programmer and never dabbled in the UDK before. (Just started playing around with it for the Ark competition.)
Event Construct is not linked to anything. (In the UI graph.)
UI is closed using Remove From Parent (in the FirstPersonCharacter template project blueprint/graph.)
In the graph for the UI, when the OnCheckStateChanged is called I “Set Is Checked” then “Execute Console Command” then “Print Text”.
In this image, in an attempt to figure things out, I made two checkboxes and played around with their output in different ways. http://i.imgur.com/hKP6YJu.jpg
Both “work” but the checkboxes don’t stay checked so I guess I’m closing the UI wrong or I need to read up on this (type?)casting stuff.
There’s your problem. Whenever you remove a widget from a parent and then add it back, it creates a new instance of the widget, so everything will be reset. Instead of removing and adding it back to the viewport, add the widget to viewport a single time. For example in the Post Begin Play of your character blueprint. Then whenever you want the Widget to be hidden/disabled, you need to set the widget’s visibility to Hidden (use the Set Visibility node) and Disable the widget (use the Set Is Enabled node). And vice versa for when you want it to be visible/enabled.
I moved the Create Widget block to be straight after the Begin Play function rather than after the key press event and the checkboxes appear to be working fine now.
(The menu starts on the screen rather than waiting for the keypress so I’ll have to fiddle around with it and figure that out. Disregard. Fixed it )
Side-question, if anyone fancies answering it, is the blueprinting system a visual representation of the C++ that’s happening in the background? Or is it something simpler?