Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

var rolloffMode: AudioRolloffMode;
AudioRolloffMode rolloffMode;
rolloffMode as AudioRolloffMode

Description

Sets/Gets how the AudioSource attenuates over distance.

	function Start() {
		audio.rolloffMode = AudioRolloffMode.Linear;
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Start() {
        audio.rolloffMode = AudioRolloffMode.Linear;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Start() as void:
		audio.rolloffMode = AudioRolloffMode.Linear