How to keep the UI states while reloading the current scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Narasima

Hi, I want to keep the UI states of the Control nodes while reloading the current scene. Is there a way to achieve this ?

:bust_in_silhouette: Reply From: godot_dev_

How I achieved this was using the following scene tree

root

UI
other nodes

I had the root node’s script store all state variables needed to stay between scene changes. I then removed the UI node and replaced it with another UI scene. Then I populated the new UI scene’s variables using the root node’s script