Answered
0
0

Someone please help me!

I have a strange issue with the getParameters function in FMOD (Last Version (today october 1st 2014)) and unity 4!

Using the example CAR ENGINE for get parameters in online PDF, I did the same as the script was there.

IF I use a bank with no parameters, just PlayOneShot, it works fine. BUT Parameters dont make any sound. Here’s my code example:

using UnityEngine;
using System.Collections;
using FMOD.Studio;


public class SomCarro : MonoBehaviour {

FMOD.Studio.EventInstance engine;
private FMOD.Studio.ParameterInstance engineRPM;
public float contador;

// Use this for initialization
void Start () {
    contador = 0; // the counter to increment a value, just for test;
    engine = FMOD_StudioSystem.instance.GetEvent ("event:/Vehicles/Car Engine");
    engine.getParameter ("RPM", out engineRPM);
    engine.start ();        

}

// Update is called once per frame
void Update () {
    contador = contador+100;
    engineRPM.setValue(contador);
    if (contador > 6000){
                    contador = 0;

       }
}
void OnDisable(){
    engine.stop (FMOD.Studio.STOP_MODE.IMMEDIATE);
    engine.release ();
}
}
  • You must to post comments
Best Answer
1
0

The code looks fine, the only thing you’re missing is setting the position of the event. The engine is a 3D event so you need to make sure that your listener is near the event. When you call getEvent without setting the 3D attributes it will default to the origin [position = (0,0,0)]. It will be silent if it is too far away from the FMOD Listener.

Add this line to Update to set the 3D position of the FMOD Event:

    engine.set3DAttributes(FMOD.Studio.UnityUtil.to3DAttributes(gameObject));
  • You must to post comments
0
0

First of all, I did a mistake putting that sentence you mentioned in the Start function…. “OMG it didn’t work! The sound stays in the place!” After my distraction, I’ve input this line in update! MANY MANY MANY Thanks! It really works and I spent my last 2 weeks trying to solve this, and i didn’t found anything! THANKS! IT WORKS VERY WELL!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.