Use “==” to compare equality. The single “=” is assignment.
Also, click the “101/010” button when entering code on unityAnswers to get it formatted correctly.
using UnityEngine;
using System.Collections;
public class volumechange : MonoBehaviour {
public static int volume;
// Update is called once per frame
void Update () {
if (volume == 1)
AudioSource.volume = 10;
if (volume == 0)
AudioSource.volume = 0;
}
}