Search Unity

what kind of class should i use for Volume Rolloff ?

Discussion in 'Scripting' started by demis_00, Jan 18, 2021.

  1. demis_00

    demis_00

    Joined:
    May 12, 2020
    Posts:
    50
    what kind of class should i use for Volume Rolloff in my custom audio script?

    public engineRolloffMode;
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,744
  3. demis_00

    demis_00

    Joined:
    May 12, 2020
    Posts:
    50
    i mean like curve rolloff linearroll off and custom rolloff. so i want to change to linear roll off for better 3d sound effects.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,744
    AnimationCurve objects are great for defining short curve functions. They're easily editable right in Unity.
     
  5. demis_00

    demis_00

    Joined:
    May 12, 2020
    Posts:
    50
    i want to modify airplane audio script from standard assets, i wanted to make sound effects sound like 3d and change volume rolloff to linear rolloff but i dont know what class i should use for volume rolloff , like float , int, bool, string and etc.
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,744
    When you say "what class" it means more what structure of control you want. That's kind of up to you and your application.

    When you want to control volume, it is a floating point quantity, so you need to feed it with such.

    Other controlling properties of the AudioSource are all available here for inspection:

    https://docs.unity3d.com/ScriptReference/AudioSource.html

    The cool thing about Unity is you can drop an AudioSource into a scene with your AudioClip on it, press PLAY and then fiddle with the controls in the editor to see what effects you get and reason about how to control that with code.