Hello,
Using the profiler, I’ve determined that a Local parameter is not functioning in our game’s Windows Desktop build, but it is functioning when running in the editor.
Build
vs
Editor
The parameter is set by code which calculates the total number of combat units/instances in the camera radius and scales the “CombatIntensity” parameter accordingly.
/// <summary>
/// Set CombatIntensity PARAMETER of this fmod event based on num instances of it playing
/// </summary>
/// <param name="geoaudioCountsKey"></param>
/// <param name="fmodEvent"></param>
public void SetCombatIntensity(string geoaudioCountsKey, FMOD.Studio.EventInstance fmodEvent)
{
// Set combat intensity based on count
if (geoaudioCountsKey.Contains("Combat"))
{
// START AT 0
int numInstancesPlaying = geoaudioCounts[geoaudioCountsKey];
float intensity = Mathf.Clamp((numInstancesPlaying - 1) * 0.25f, 0f, 1f);
fmodEvent.setParameterByName("CombatIntensity", intensity);
//Debug.Log("CombatIntensity " + geoaudioCountsKey + " " + intensity + " num instances " + numInstancesPlaying);
}
}
public void EnteredGeoAudio(GeoAudio ga)
{
if (activeGeoaudio.Contains(ga))
return;
activeGeoaudio.Add(ga);
ga.camera_within_our_bounds = true;
// Increase instances of this geoaudio present
if (!geoaudioCounts.ContainsKey(ga.transform.name))
geoaudioCounts[ga.transform.name] = 0;
geoaudioCounts[ga.transform.name]++;
// Play sound in FMOD
if (!ga.fmodEvent.IsNull)
{
FMOD.Studio.EventInstance fmodEvent = AudioManager.audio_manager.PlayPersistentFMODAudio(ga.fmodEvent);
SetCombatIntensity(ga.transform.name, fmodEvent);
}
We are not encountering any issues with other parameters in the build. The CombatIntensity parameter does happen to be the only Local parameter we are setting by code.
Each instance of a combat unit’s related FMOD Event uses the CombatIntensity parameter on a number of automations including track volumes, fx properties, and Scatterer Instrument spawn rates.
Using FMOD v 2.02.23 and Unity 2022.3.22f1
Any help would be very much appreciated.
Thanks!