At the moment a background Audio is playing over all scenes. But I want only a few scenes to play it. I try to fix it with an if-query, but it only says “Cannot implicitly convert type ‘void’ to 'bool”, how can I fix it?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Audio : MonoBehaviour {
static Audio instance = null;
private void Awake()
{
if (instance != null) {
Destroy (gameObject);
}
else {
instance = this;
if (SceneManager.LoadScene (“Dodge!”)) {
GameObject.DontDestroyOnLoad (gameObject);
}
}
}
public void ToggleSound()
{
if(PlayerPrefs.GetInt(“Muted”,0) == 0) {
PlayerPrefs.SetInt (“Muted”, 1);
//AudioListener.volume = 1;
}
else
{
PlayerPrefs.SetInt (“Muted”, 0);
//Audiolistener.volume = 0;
}
}
}