# Unable to get parameter max value

**URL:** <https://qa.fmod.com/t/unable-to-get-parameter-max-value/22655>\
**Category:** FMOD Engine\
**Tags:** unity\
**Created:** [March 3, 2025, 7:48pm UTC](https://qa.fmod.com/t/unable-to-get-parameter-max-value/22655 "2025-03-03T19:48:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronia](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Ronia](https://qa.fmod.com/u/Ronia)\
**Post date:** [March 3, 2025, 7:48pm UTC](https://qa.fmod.com/t/unable-to-get-parameter-max-value/22655/1 "2025-03-03T19:48:47Z")

</div>

Hi, I’m trying to access a parameter max value to use it in my code.  
I found this topic looking through the forums, wich was really helpful: [Read out parameter Min and Max value?](https://qa.fmod.com/t/read-out-parameter-min-and-max-value/21529).  
I follow what I understand is the logical way to achive my goal, but I can not make it work.

I’m sharing my code:

```auto
    public void SetLevelParameter(int value, int maxValue)
    {
        int parameterMaxValue;
        PARAMETER_DESCRIPTION parameterDescription = default;

        musicInstance.getDescription(out EventDescription description);

        if (description.isValid())
            description.getParameterDescriptionByName(levelPN, out parameterDescription);
        else
            Debug.LogWarning("There is no description for music event");

        parameterMaxValue = (int)parameterDescription.maximum;

        float levelsPerTrack = maxValue / parameterMaxValue;
        int fixValue = Mathf.FloorToInt(value / levelsPerTrack);

        musicInstance.setParameterByName(levelPN, fixValue);
    }

```

I always get: “There is no description for music event” or an error saying that I can not divide by zero (this line: float levelsPerTrack = maxValue / parameterMaxValue;)

Any help on how to properly access parameter’s max value would be great!  
Thanks.

---

<div class="post-metadata">

**Author:** ![Ronia](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Ronia](https://qa.fmod.com/u/Ronia)\
**Post date:** [March 4, 2025, 11:55am UTC](https://qa.fmod.com/t/unable-to-get-parameter-max-value/22655/2 "2025-03-04T11:55:13Z")

</div>

In case anyone is looking to do the same, the code above works fine. I just needed to restart unity for some reason.

You first have to get Event Description of the event that contains the parameter you need:

```auto
EventInstance eventInstance;
EventDescription eventDescription;

eventInstance.getDescription(out eventDescription)

```

Get Parameter Description from Event Desctiption:

```auto
string parameterName = "Your parameter name";
PARAMETER_DESCRIPTION parameterDescription;

eventDescription.getParameterDescriptionByName(parameterName, out parameterDescription);

```

And then you can access parameter max and min values:

```auto
parameterDescription.maximum;
parameterDescription.minimum;

```

---

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [March 4, 2025, 9:47pm UTC](https://qa.fmod.com/t/unable-to-get-parameter-max-value/22655/3 "2025-03-04T21:47:11Z")

</div>

Thank you for sharing your solution here!
