Increment parameter command applies incorrect change when negative

I am encountering what appears to be a bug when using the “Increment parameter” command type. I have a loop region which I have given a condition to only loop when a parameter called “LoopRemaining” is bigger than 0. Then I have a command instrument within the loop which is meant to decrease that parameter by 1 each time it is triggered. I have set the command instrument to have a “Delta Value” of -1 but each time it is triggered I can see that the parameter is in fact decreased by 2. I have also recreated this in a brand new project with nothing else but a 2D timeline containing a single loop region, a command instrument and the parameter as described above so I don’t think it’s anything else in my project that is causing it.

If I set the “Delta Value” to -2 it appears to result in -3 so it’s off by one when negative. If I set the “Delta Value” to 1 instead it seems to increment correctly. But then I lose the ability to set the allowed number of loops in advance by setting the parameter from code before starting the event. I guess I could also just build all my logic around the idea that -1 means -2 in practice, but that seems pretty silly and error prone.

Am I misunderstanding something about how this should work or is this a bug? I can provide a recreation project if needed, but it is easy to recreate based on what I described.

FMOD Studio version: 2.02.03, 64-bit, Build #120077
OS: Windows 10 21H2, build 19044.1526

I can’t reproduce this bug on mac OS (Studio & runtime). It would be interesting to know what is causing this. :eyes:

I can’t reproduce this behavior. When I test here, the parameter correctly increments by -1 each loop.

Given that you can reproduce this reliably and I can’t, it’s likely that there’s some detail of your events that differs from mine. Can you please post a screenshot of your event, including the command instrument and loop region? Being able to see the command instrument’s properties in the deck would also be useful. (Or you could send us a project that exhibits the issue, if you prefer.)

Thanks for testing. I have included screenshots as I’m not allowed to upload a zip of the project. In this example the loop happens twice and then it continues past the loop. Expected behavior would be 4 loops, not 2. It is otherwise an entirely fresh project, what you see is all I did.

Thanks. I’ve now been able to reproduce the issue, and have added it to our bug tracker. It’ll be fixed in an upcoming version of FMOD Studio.

The bug seems like it only affects discrete and labelled parameters, so you should be able to work around it by converting your discrete parameters to continuous parameters for now.

That’s great news! I can confirm that switching to continuous solves the issue I was having. Thanks!