Skip to content

manuelmakesartz/Volume-Sliders-Singleton-example-

Repository files navigation

Volume Sliders (Singleton example)

Imagine this:

You made yourself some volume sliders. Great! But when you change the slider's value (visually), debug, swicth scenes and then come back to the scene with the sliders, you notice that it resets to its original position. "How do I fix that?" you may ask. Well, here's a template project to fix this issue, while also understanding how singletons can be implemented to store values!

What is a "Singleton"?

According to the official Godot Documentation, it's a useful tool for solving the common use case where you need to store persistent information between scenes.

In simple terms: It's a script that stores variables, functions or other values that you can recall any time, on any script, for any scene!

How do I make and use a Singleton?

This project is basically a form of tutorial so you can understand how singletons work. In this case scenario, you're gonna learn it in practice using volume sliders! To get the most out of this template, open both this and your project and use the code as a reference accordingly to the needs of your project.

Do not copy and slam the entire project to yours and try to run it immediantly. It won't work and you'll look stupid by doing that. Seriously, the code ITSELF has a guide on what each thing does.

To learn more about Singletons and their use, press here

About

Learn how singletons can be implemented to store values with the simple example of volume sliders!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published