make TetrisBlock save the level and make it be accessible in different scenes:

``` TetrisBlock.cs:


using UnityEngine;
using TMPro;

// note for self, nekad vairāk nerakstit 400 liniju script, ja tas nav needed.

public class TetrisBlock : MonoBehaviour
{
    public static byte LinesCleared;
    public static int height = 21;
    public static int width = 10;
    public static float fallTimeDecrease;
    public static float minFallTime = 0.1f;
    public static float fallTime;
    public static float CurrentFallTime { get; private set; } = 1f;
    public static byte linesPerLevel = 10;
    public static bool gameOver = false;

    private static float initialFallTime = 1f;
    private float previousTime;
    private static int level = 0;
    public static int Level
    {
        get { return level; }
        private set
        {
            level = value;
            PlayerPrefs.SetInt("TetrisLevel", level);
            PlayerPrefs.Save();
        }
    }


    private GameManager gameManager;
    private SpawnTetromino spawnTetromino;
    private static TextMeshProUGUI linesClearedText;
    private static TextMeshProUGUI levelText;
    private AudioSource audioSource;
    public Vector3 rotationPoint;
    
    private static TetrisBlock instance;
    public AudioClip moveSound;

    void Awake()
    {
        gameManager = FindObjectOfType<GameManager>();
        spawnTetromino = FindObjectOfType<SpawnTetromino>();
        linesClearedText = GameObject.Find("Lines_Cleared").GetComponent<TextMeshProUGUI>();
        levelText = GameObject.FindWithTag("Text_Level").GetComponent<TextMeshProUGUI>();
        fallTime = CurrentFallTime;
        
        if (levelText == null)
        {
            Debug.LogError("No level text found");
        }
        
        Debug.Log(SceneController.noFunPressed);

        ResetGame();
        SetupAudioSource();
        CalculateFallDecrement();

        instance = this;
        moveSound = AudioManager.Instance.audioClips[0];
    }

    private void Update()
    {
        if (gameManager.StartMenu != null && !gameManager.StartMenu.activeSelf)
        {
            HandleInput();
        }
    }

    void CalculateFallDecrement()
    {
        if (SceneController.noFunPressed)
        {
            fallTimeDecrease = 0.9f;
        } 
        else if (SceneController.sweatPressed)
        {
            fallTimeDecrease = 0.4f;
        }
        else if (SceneController.hardPressed)
        {
            fallTimeDecrease = 0.2f;
        }
        else if (SceneController.SkillIssuePressed)
        {
            fallTimeDecrease = 0.05f;
        }
        else
        {
            fallTimeDecrease = 0.1f;
        }
    }

    private void ResetGame()
    {
        if (SceneController.hasRestartedScene)
        {
            CurrentFallTime = initialFallTime;
            level = 0;
            LinesCleared = 0;
            UpdateUi();
            SceneController.hasRestartedScene = false;
            Debug.Log($"The current fall time is: {CurrentFallTime}");
        }
    }

    private void HandleInput()
    {
        if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A))
        {
            MoveHorizontal(-1);
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D))
        {
            MoveHorizontal(1);
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            Rotate();
        }
        if (Time.time - previousTime > (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S) ? fallTime / 10 : fallTime))
        {
            MoveDown();
        }
    }

    private void MoveHorizontal(int direction)
    {
        AudioManager.Instance.PlayMoveSound();
        transform.position += new Vector3(direction, 0, 0);
        if (!ClearLine.ValidMove(transform))
            transform.position -= new Vector3(direction, 0, 0);
    }

    private void Rotate()
    {
        AudioManager.Instance.PlayRotateSound();
        transform.RotateAround(transform.TransformPoint(rotationPoint), Vector3.forward, 90);
        if (!ClearLine.ValidMove(transform))
            transform.RotateAround(transform.TransformPoint(rotationPoint), Vector3.forward, -90);
    }

    private void MoveDown()
    {
        transform.position += Vector3.down;
        if (!ClearLine.ValidMove(transform))
        {
            transform.position -= Vector3.down;
            ClearLine.AddToGrid(transform);
            ClearLine.CheckForLines();
            this.enabled = false;

            if (!ClearLine.isLineClearAnimationInProgress && !gameOver)
            {
                spawnTetromino.NewTetromino();
            }
        }
        previousTime = Time.time;
    }

    public static void UpdateUi()
    {
        if (linesClearedText != null)
        {
            linesClearedText.text = "Lines Cleared: " + LinesCleared.ToString();
        }
        if (levelText != null)
        {
            levelText.text = "Level: " + level.ToString();
        }
        else
        {
            Debug.LogError("Level TextMeshProUGUI component not found!");
        }
    }

    

    public static void LevelUp()
    {
        AudioManager.Instance.LevelUpSound();
        int newLevel = LinesCleared / linesPerLevel;
        
        if (newLevel > level)
        {
            int levelDifference = newLevel - level;
            for (int i = 0; i < levelDifference; i++)
            {
                CurrentFallTime = Mathf.Max(CurrentFallTime - fallTimeDecrease, minFallTime);
            }
            
            level = newLevel;
            UpdateUi();
            
            if (newLevel == 157)
            {
                GameManager.Instance.WaitWhat();
            }

            TetrominoColorManager.Instance.UpdateColorOnLevelUp();
        }
        Debug.Log($"Current fall time: {CurrentFallTime}, Current level: {level}");
    }

    public static void ResetStaticVariables()
    {
        ClearLine.ResetGrid();
        LinesCleared = 0;
        gameOver = false;
        UpdateUi();
    }

    private void SetupAudioSource()
    {
        if (audioSource == null)
        {
            audioSource = gameObject.AddComponent<AudioSource>();
        }

        audioSource.clip = moveSound;
        audioSource.playOnAwake = false;
    }
}
```

```SpawnTetromino.cs:

using UnityEngine;
using Random = UnityEngine.Random;
public class SpawnTetromino : MonoBehaviour
{
    public static SpawnTetromino Instance { get; private set; }

    public GameObject[] Tetrominoes;
    public Transform previewTransform;
    public GameObject[] ColoredBlockPrefabs;
    private GameObject previewPiece;
    private int currentIndex;
    private int nextIndex;
    public GameObject GameOverScreen;

    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
            return;
        }
    }

    void Start()
    {
        currentIndex = Random.Range(0, Tetrominoes.Length);
        nextIndex = Random.Range(0, Tetrominoes.Length);

        CreatePreview();
        SpawnCurrentPiece();

        GameOverScreen.SetActive(false);
    }

    private void SpawnCurrentPiece()
    {
        if (!TetrisBlock.gameOver)
        {
            GameObject spawnedTetromino = Instantiate(Tetrominoes[currentIndex], transform.position, Quaternion.identity);
            spawnedTetromino.AddComponent<ClearLine>();
            UpdateTetrominoColor(spawnedTetromino);
        }
    }
    
    public void UpdateTetrominoColor(GameObject tetromino)
    {
        if (ColoredBlockPrefabs.Length == 0) return;

        int currentLevel = TetrisBlock.LinesCleared / TetrisBlock.linesPerLevel;
        int colorIndex = currentLevel % ColoredBlockPrefabs.Length;

        foreach (Transform child in tetromino.transform)
        {
            SpriteRenderer spriteRenderer = child.GetComponent<SpriteRenderer>();
            if (spriteRenderer != null)
            {
                spriteRenderer.sprite = ColoredBlockPrefabs[colorIndex].GetComponent<SpriteRenderer>().sprite;
            }
        }
    }

    public void NewTetromino()
    {
        if (!TetrisBlock.gameOver && !ClearLine.isLineClearAnimationInProgress)
        {
            currentIndex = nextIndex;
            nextIndex = Random.Range(0, Tetrominoes.Length);

            SpawnCurrentPiece();

            if (previewPiece != null)
            {
                Destroy(previewPiece);
            }
            CreatePreview();
        }
    }

    private void CreatePreview()
    {
        switch (nextIndex)
        {
            case 0:
                previewPiece = Instantiate(Tetrominoes[nextIndex], new Vector3(12.5f, 16.73f, 1), Quaternion.identity);
                break;
            case 3:
                previewPiece = Instantiate(Tetrominoes[nextIndex], new Vector3(12.5f, 15.73f, 1), Quaternion.identity);
                break;
            case 2:
            case 6:
                previewPiece = Instantiate(Tetrominoes[nextIndex], new Vector3(12, 16.73f, 1), Quaternion.identity);
                break;
            case 5:
                previewPiece = Instantiate(Tetrominoes[nextIndex], new Vector3(13, 15.73f, 1), Quaternion.identity);
                break;
            default:
                previewPiece = Instantiate(Tetrominoes[nextIndex], previewTransform.position, Quaternion.identity);
                break;
        }

        UpdateTetrominoColor(previewPiece);

        TetrisBlock previewBlock = previewPiece.GetComponent<TetrisBlock>();
        if (previewBlock != null)
        {
            previewBlock.enabled = false;
        }
    }

    public void GameOver()
    {
        TetrisBlock.gameOver = true;
        GameOverScreen.SetActive(true);
        AudioManager.Instance.backGroundAudioSource.Stop();
        Debug.Log("Game Over");
    }
}
```
```GameManager.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GameManager : MonoBehaviour
{
    public static GameManager Instance { get; private set; }
    
    public GameObject StartMenu;
    public GameObject TheImpossible;


    void Awake()
    {
        Instance = this;
    }

    void Start()
    {
        if (SceneController.hasRestartedScene)
        {
            StartMenu.SetActive(false);
        }
        else
        {
            StartMenu.SetActive(true);
        }
        TheImpossible.SetActive(false);
    }

    void Update()
    {
        StartMenuFunc();
    }

    void StartMenuFunc()
    {
        bool isActive = StartMenu.activeSelf;
        if (StartMenu.activeSelf)
        {
            Time.timeScale = 0;
        }
        else
        {
            Time.timeScale = 1;
        }
    }

    public void StartBtn()
    {
        AudioManager.Instance.backGroundAudioSource.Play();
        StartMenu.SetActive(false);
    }

    public void WaitWhat()
    {
        Time.timeScale = 0;
        TheImpossible.SetActive(true);
    }

}
```