- Home /
an object reference is required to access non static member problem
I am getting this error. an object reference is required to access non static member 'UnityEngine.AudioSource.volume' here is my script 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;
}
}
Comment
Your answer
Follow this Question
Related Questions
How to make classes/structs public to all scripts 0 Answers
Defining a public class in C# 1 Answer
cannot implicitly convert type 'int' to 'bool' problem 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers