We use a labeled parameter to play different sounds for different magic types.
Both the Unity and the FMOD we use have been updated today and nothing works still.
despite setting the parameter to “Light” it plays the default sound still. We tried using discrete as well, doesn’t work either.
Maybe something with the fact it’s labeled? Though, according to the API, that’s how it should be used …right?
Helplease.
From my testing, setParameterByNameWithLabel()
works as intended. There are a few variables that could be in play here. Could you please check the following:
- There are no seek speeds or velocity settings on the
magicType
parameter
- The
magicType
parameter is not set to read only or is not a global parameter
- Are there any warnings or errors being logged in the Unity console
- Are you able to do the same actions but using a more direct approach with game code (manually instantiate and set the parameter of the event in a script) rather than manipulating the EventEmitter?
Hey there, thanks for doing your best to help.
The first three the answer is no.
As for the fourth- it does work if we it set in the editor window, but we need it to work from within the code.
Are you able to do the code more like this in a new script and see if that works:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class setEventLabel : MonoBehaviour
{
public FMODUnity.EventReference eventReference; // Select your event from the game object
FMOD.Studio.EventInstance eventInstance;
// Start is called before the first frame update
void Start()
{
eventInstance = FMODUnity.RuntimeManager.CreateInstance(eventReference);
eventInstance.start();
eventInstance.setParameterByNameWithLabel("magicType", "Light");
}
// Update is called once per frame
void Update()
{
}
}
The programmer says that thats exactly what he did but it didn’t work.
Are you able to put this event into a new project and send it over? Right click > Copy onto the event in question, open a new blank FMOD Studio project and paste. It should bring across all relevant assets and bus routing. Feel free to delete the assets if you don’t wish to share it. Then could you send that new project to me in a DM and I’ll take a closer look?
Hey there, just wanted to make sure you got the mail (sent it a few days ago)
Yes, it has arrived thanks. It was assigned to my queue yesterday and I’m taking a look into it now.
I’ve taken a look and everything in the project appears fine. It looks like what is happening is you are setting the parameter value on the event instance of the event emitter, but what you need to do is set the parameter on the emitter directly before playing it (the emitter will cache the parameters until Play is called).
soundObj.GetComponent<FMODUnity.StudioEventEmitter>().SetParameter("MagicType", 0.75f);
soundObj.GetComponent<FMODUnity.StudioEventEmitter>().EventInstance.setParameterByNameWithLabel("MagicType", "Light");
Currently, the EventEmitter.SetParameter()
function does not support labels so you can either implement it yourself or just use floats.
ok I’ll talk to the programmer about it.
Thanks a lot
Hello! Writing to you back through here because…
I’m trying to run an event that is set up like any other in Unity, it runs in the banks and other events run well.
What could be the problem?
Big thanks in advance
I’m attaching a video with the problem recorded
(Attachment 2022-04-18 22-34-36.mkv is missing)
I’m unable to see the video you’ve tried to attach, but does the console log any warnings or errors when this event is played?