Change pitch of an instance

Hello everyone,

I am trying to change the pitch of an instance before and after the instance is called but I cannot really do it.

I don’t want to use parameter or snapshot but I want to change the pitch value via script and I want to do that real time so the instance will change pitch while playing.

I have tried the .setPitch(float) function for the instances but there is no change on the pitch when I pass positive numbers to the function. Also, if I pass negative values to the function it throws an assertion error. I checked the API and it is a range error.

Any ideas?

I am using Unity 2019.2.4f1 and FMOD Studio 2.01.04.

Could you post some of your code examples so that we can see how you’re trying to achieve this?

It sounds like what you need is indeed setPitch, keep in mind that function only accepts positive numbers. For instance a pitch of 2.0f is one octave up and a pitch of 0.5f is one octave down. As mentioned by @Paalo, a code example might highlight what your issue is.

Hello @Paalo @matthew ,

Thank you for your replies.

I am not sure what I was doing wrong but my code looks like this and it works fine.

_instance = FMODUnity.RuntimeManager.CreateInstance(_eventPath);
_instance.setPitch(0.5f);