Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[SOLVED] How to Set reverbPreset via Script (aka What is Enumeration?)

Discussion in 'Scripting' started by B-30, Nov 5, 2016.

  1. B-30

    B-30

    Joined:
    Nov 3, 2014
    Posts:
    28
    I'm trying to set the reverbPreset to "User" via script.

    Evidently, I don't understand what "enumeration" is, because the manual says "AudioReverbPreset" is a kind of enumeration.

    I've tried
    Code (csharp):
    1. reverbZone.reverbPreset.User = true;
    and
    Code (csharp):
    1. reverbZone.reverbPreset = "User";
    but these give type errors (i.e., "cannot convert string to AudioReverbPreset") - I assume I need to give it an enumeration, but I don't understand what that is :(

    Btw, I'm accessing other properties of the reverbZone just fine. Any help most appreciated.

    B-30
     
  2. B-30

    B-30

    Joined:
    Nov 3, 2014
    Posts:
    28
    Found the answer:
    Code (csharp):
    1. reverbZone.reverbPreset = AudioReverbPreset.User
    ...evidently an enumeration is a way to define a set of named constants that can be applied to a variable.