Search Unity

Question How to stop the background music when returning to menu and not collapse music?

Discussion in 'Visual Scripting' started by xinyinglee01, Apr 20, 2021.

  1. xinyinglee01

    xinyinglee01

    Joined:
    Apr 12, 2021
    Posts:
    1
    Here is my script for my bgm:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class DontDestroyAudio : MonoBehaviour
    {
    private static DontDestroyAudio instance;
    void Awake()
    {
    if (instance != null)
    {
    Destroy(gameObject);
    }
    else
    {
    instance = this;
    DontDestroyOnLoad(gameObject);
    }
    }
    }
     
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,065
    Wrong subforum. This is for Unity Visual Scripting tool, also known as Bolt.