/
crypt
/
SnowBallRefactoring
Обзор
Документация
Войти
/
crypt
/
SnowBallRefactoring
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/Scripts/musicInGame.cs
36 строк
790 B
crypt
Мой первый проект. Старт рефакторинга.
21 июл 2026, 18:23
21 июл 2026, 18:23
bef234c
Код
Авторство
О чём код?
using UnityEngine; using System.Collections; using UnityEngine.UI; public class musicInGame : MonoBehaviour { public static musicInGame instance = null; void Start() { if (instance != null) { Destroy(gameObject); Debug.Log("One Music Destroyed"); return; } instance = this; DontDestroyOnLoad(gameObject); } // Update is called once per frame void Update () { if (PlayerPrefs.GetInt("isMusic") == 1) gameObject.GetComponent<AudioSource>().volume = 0.6f; else gameObject.GetComponent<AudioSource>().volume = 0; if (Application.loadedLevel == 2) { gameObject.GetComponent<AudioSource>().volume = 0; } } }