ERR_INVALID_HANDLE for STUDIO_EVENTINSTANCE

Hello everyone, I am brand new to using FMOD, and despite my best efforts to follow just about every tutorial and documentation I could find, I am getting a long string of errors on Update() when trying to change the value of RPM based on a float being pulled from a car controller.

using System;
using UnityEngine;

public class CarEngine : MonoBehaviour
{
    FMOD.Studio.EventInstance EngineSounds;

    FMOD.Studio.EventDescription ESDescription;
    FMOD.Studio.PARAMETER_DESCRIPTION pd;
    FMOD.Studio.PARAMETER_ID pID;

    public GameObject car;
    private MSVehicleControllerFree carScript;

    private void Start()
    {


        carScript = car.GetComponent<MSVehicleControllerFree>();

        ESDescription = FMODUnity.RuntimeManager.GetEventDescription("event:/Engine Sounds");
        ESDescription.getParameterDescriptionByName("RPM", out pd);

        pID = pd.id;

        EngineSounds.start();
    }
    private void Update()
    {
        float RPM = carScript.pitchAUD / 2f;

        EngineSounds.setParameterByID(pID, RPM);
    }
}

These are the errors I’m getting:

Any help at all would be appreciated

I ended up fixing this issue and after rewriting my scripts it work mostly now, however I’m returning and error that says my event can’t be found when I’m trying to CreateInstance. I will paste the new script when I return to my computer (Although, the new script itself is very similar to the original)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class What : MonoBehaviour
{
    FMOD.Studio.EventInstance EngineSounds;

    FMOD.Studio.EventDescription engineDesc;
    FMOD.Studio.PARAMETER_DESCRIPTION pd;
    FMOD.Studio.PARAMETER_ID pID;

    [Range(0.0f, 1.0f)]
    public float RPM;
    //[FMODUnity.EventRef]
    //public string eSounds;

    private void Start()
    {
        EngineSounds = FMODUnity.RuntimeManager.CreateInstance("event:/EngineSounds");
        EngineSounds.start();
        EngineSounds.release();

        engineDesc = FMODUnity.RuntimeManager.GetEventDescription("event:/EngineSounds");
        engineDesc.getParameterDescriptionByName("RPM", out pd);
        pID = pd.id;
        SoundsUpdate();
    }

    private void SoundsUpdate()
    {
        EngineSounds.setParameterByID(pID, RPM);
    }
}

Edit: The solution was to make the parameters global and use the respective API

1 Like

Thank you for sharing your solution!

1 Like