I'm converting from js to c# and hit this error:
error CS0176: Static member `UnityEngine.AudioListener.volume' cannot be accessed with an instance reference, qualify it with a type name instead
Here's the code:
audioListener is populated in Awake(), here:
audioListener is defined as:
What do I need to do differently?
In this case, it's because
is itself a static variable! As such, you can't access it from an instance, because it should be accessed only as a member of the class itself. In this case, whenever you want to change the volume, all you have to do is use that one line instead of trying to find the current audioListener in the scene.
answered May 10 '12 at 09:58 AM