Settings are saved but look as though they aren't!

So, the settings menu in my game does function properly, but, when you leave the scene, the data remains the same, but the visuals revert to how they were in the beginning.

Does anyone know how to fix this?

The starting settings

Changed Settings

But when you go back and enter the settings again:

Are you setting all the visuals according to saved data when showing the settings window?

I’m really new to unity and coding in general, I started recently. Right now, I’m using tutorials and such to make my game.

So I dont know how I would do that

Please show your code

What do I show? all the scene has is a few UI elements with scripts that relate to its actions.

scripts that relate to its actions - exactly this

Anyway, based on your answers I am pretty sure you don’t quite understand how the UI system works (.

Visuals do not magically remember their state between scene loads. Whenever you are showing a settings window you should set everything (resolution on a dropdown menu, fullscreen toggle, volume bar) yourself. Read saved data and set it accordingly (like for example a value of slider)

I suppose I understand, I’ll see what I can do, thanks

Just show your scripts that you have

This is the problem with multi-spamming the message the way you did. I already told you EXACTLY how to fix it in your other post here:

https://discussions.unity.com/t/882548/2

I’ll re-paste the notes here for you:

Check all your data flows… you’re responsible for getting the data from and to:
- persistent state storage (whatever you’re using)
- intermediate working storage
- the UI presentation
And back. That gives you a list of all the flows… it sounds like you’re missing one step.

You must find a way to get the information you need in order to reason about what the problem is.

What is often happening in these cases is one of the following:

  • the code you think is executing is not actually executing at all
  • the code is executing far EARLIER or LATER than you think
  • the code is executing far LESS OFTEN than you think
  • the code is executing far MORE OFTEN than you think
  • the code is executing on another GameObject than you think it is
  • you’re getting an error or warning and you haven’t noticed it in the console window

To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run? what order does it run in?
  • what are the values of the variables involved? Are they initialized? Are the values reasonable?
  • are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)

Knowing this information will help you reason about the behavior you are seeing.

If your problem would benefit from in-scene or in-game visualization, Debug.DrawRay() or Debug.DrawLine() can help you visualize things like rays (used in raycasting) or distances.

You can also call Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene manually, looking for all the parts, where they are, what scripts are on them, etc.

You can also call GameObject.CreatePrimitive() to emplace debug-marker-ish objects in the scene at runtime.

You could also just display various important quantities in UI Text elements to watch them change as you play the game.

If you are running a mobile device you can also view the console output. Google for how on your particular mobile target, such as this answer or iOS: https://discussions.unity.com/t/700551 or this answer for Android: https://discussions.unity.com/t/699654

Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.

Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:

https://discussions.unity.com/t/839300/3