You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
301 B

  1. using UnityEngine;
  2. public class DontDestroy : MonoBehaviour
  3. {
  4. void Awake()
  5. {
  6. GameObject[] objs = GameObject.FindGameObjectsWithTag("Music");
  7. if (objs.Length > 1)
  8. {
  9. Destroy(this.gameObject);
  10. }
  11. DontDestroyOnLoad(this.gameObject);
  12. }
  13. }