Hello, after a while of FMOD working fine ive run into a peculiar issue, where FMOD is only able to access one of my parameters. The code I am using to refer to the parameter that wont load is identical, so Im confused as to why it isnt working. It looks like there is a \ instead of a / before Desktop/Car Engines, could that be the issue?
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class What : MonoBehaviour
{
FMOD.Studio.EventInstance EngineSounds;
FMOD.Studio.EventInstance GravelSounds;
//FMOD.Studio.EventDescription engineDesc;
FMOD.Studio.PARAMETER_DESCRIPTION pd;
FMOD.Studio.PARAMETER_DESCRIPTION Apd;
FMOD.Studio.PARAMETER_DESCRIPTION Spd;
FMOD.Studio.PARAMETER_ID SpID;
FMOD.Studio.PARAMETER_ID pID;
FMOD.Studio.PARAMETER_ID ApID;
public bool turboFart;
[Range(0.0f, 1.0f)]
public float RPM;
public bool input;
public float inputVal;
//[FMODUnity.EventRef]
//public string eSounds;
[Header("Dust Trails")]
public ParticleSystem pSys1;
public ParticleSystem pSys2;
public bool includeChildren = true;
public bool isEmitting;
[Header("Object with vehicle script")]
public float velocity;
//public GameObject car;
public MSVehicleControllerFree vehicleControl;
public void Start()
{
EngineSounds = FMODUnity.RuntimeManager.CreateInstance("event:/EngineSounds");
GravelSounds = FMODUnity.RuntimeManager.CreateInstance("event:/Gravel Sounds");
EngineSounds.start();
GravelSounds.start();
FMODUnity.RuntimeManager.StudioSystem.getParameterDescriptionByName("RPM", out pd);
pID = pd.id;
FMODUnity.RuntimeManager.StudioSystem.getParameterDescriptionByName("Input", out Apd);
ApID = Apd.id;
FMODUnity.RuntimeManager.StudioSystem.getParameterDescriptionByName("Input", out Spd);
SpID = Spd.id;
EngineSounds.release();
GravelSounds.release();
}
void Update()
{
velocity = vehicleControl.velxCurrentRPM;
EngineSounds.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
GravelSounds.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
input = Input.GetKey(KeyCode.W);
RPM = vehicleControl.pitchAUD - 0.85f;
if (!turboFart)
{
inputVal = Input.GetAxis("Vertical");
}
else
{
inputVal = 0f;
}
FMODUnity.RuntimeManager.StudioSystem.setParameterByID(SpID, velocity);
FMODUnity.RuntimeManager.StudioSystem.setParameterByID(pID, RPM);
FMODUnity.RuntimeManager.StudioSystem.setParameterByID(ApID, inputVal);
if (vehicleControl.sidewaysSlipMaxSkid > 0.5f)
{
if (inputVal >= 0.5f)
{
FMODUnity.RuntimeManager.StudioSystem.setParameterByID(pID, RPM + 0.25f);
FMODUnity.RuntimeManager.StudioSystem.setParameterByID(ApID, inputVal);
}
}
turboFart = vehicleControl.turboFart;
var emission1 = pSys1.emission;
var emission2 = pSys2.emission;
if (velocity >= 30f)
{
pSys1.Play(); emission1.enabled = true; // Applies the new value directly to the Particle System
pSys2.Play(); emission2.enabled = true;
//var emission = pSys1.
isEmitting = true;
} else
{
pSys1.Stop(); emission1.enabled = false; // Applies the new value directly to the Particle System
pSys2.Stop(); emission2.enabled = false;
isEmitting = false;
}
}
}
(Sorry if its messy, havent gotten around to cleaning up the commented out code)