UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"Does not destroy the game object when loading next scene"
using System.Collections; using System.Collections.Generic; using UnityEngine; public class DontDestroyGameObject : MonoBehaviour { void Awake() { GameObject[] objs = GameObject.FindGameObjectsWithTag("music"); if (objs.Length > 1) { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); } }