MIF_E31211986/Assets/Script/DoNotDestroy.cs

17 lines
371 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DoNotDestroy : MonoBehaviour
{
void Awake()
{
GameObject[] musicObj = GameObject.FindGameObjectsWithTag("GameMusic");
if( musicObj.Length > 1)
{
Destroy(this.gameObject);
}
DontDestroyOnLoad(this.gameObject);
}
}