Problem with Scene Safe

Hi there I have a problem. I don’t want the levels to reset when I finish a scene. Does anyone have a solution? Here I also have a Youtube video if you don’t understand what I mean. Thanks in advance

my scenes:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ProgressBar : MonoBehaviour
{
    [SerializeField]
    private Text text_1;

    [SerializeField]
    private Text text_2;

    [SerializeField]
    private Image bar_fill;

    [SerializeField]
    private Image bar_outline;

    [SerializeField]
    private Image circle_1;

    [SerializeField]
    private Image circle_2;

    [SerializeField]
    private Color color;

    [SerializeField]
    private Color background_color;

    private int level = 0;

    private float currentAmount = 0;

    private Coroutine routine;

    void OnEnable()
    {
        InitColor();
        level = 0;
        currentAmount = 0;
        bar_fill.fillAmount = currentAmount;
        UpdateLevel(0);
    }

    void InitColor()
    {
        circle_1.color = color;
        circle_2.color = color;

        bar_fill.color = color;
        bar_outline.color = color;

        text_1.color = background_color;
        text_2.color = color;
    }

    public void UpdateProgress(float amount, float duration = 0.1f)
    {
        if (routine != null)
            StopCoroutine(routine);
        float target = currentAmount + amount;
        routine = StartCoroutine(FillRoutine(target, duration));
    }

    private IEnumerator FillRoutine(float target, float duration)
    {
        float time = 0;
        float tempAmount = currentAmount;
        float diff = target - tempAmount;
        currentAmount = target;

        while (time < duration)
        {
            time += Time.deltaTime;
            float percent = time / duration;
            bar_fill.fillAmount = tempAmount + diff * percent;
            yield return null;
        }

        if (currentAmount >= 1)
            LevelUp();
    }

        private void LevelUp()
        {
            UpdateLevel(level + 1);
            UpdateProgress(-1f, 0.2f);
        }

        private void UpdateLevel(int level)
        {
            this.level = level;
            text_1.text = this.level.ToString();
            text_2.text = (this.level + 1).ToString();
        }
    }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestButton : MonoBehaviour
{
    [SerializeField]
    ProgressBar bar;

    public void TestClick()
    {
        bar.UpdateProgress(0.1f);
    }
}

This is fundamental to how Unity works. Use ScriptableObjects instead. More here.

you can use playerprefs

Playerprefs don´t work i tested

When you stop play mode and start play mode again it is the same as if you had a build, launched the build, exited the build, then launched it again. If you want to have data persist between these separate runs of the game you need to serialize that data and save it somewhere. Then when you launch again you need to read that data back and put the data where it needs to go.

You could save it to disk in some kind of text based or binary file, you could save it to PlayerPrefs, you could save it to a database, you could save it to some cloud service, etc, etc, etc. Figure out how exactly you want to do it, then try to do it. If you run into a problem you can then ask a specific question about exactly how you’re trying to do it.

Just saying PlayerPrefs don’t work is just silly. The feature certainly does work, but it isn’t some silver bullet that just handles everything for you. You still have to design your scripts to properly write the data as needed, read it back when your game launches, and act on that read data to put everything in your scene back to the same state it was when you saved the data.