Answered
0
0

I am new to Fmod and C# in general, so bear with me when I say that (I think) I’m changing a parameter in Unity during playback, and it isn’t responding properly. I’ve confirmed that the input values I need are being properly calculated, and that the values I’m setting are being changed to the proper numbers. I think I might not be referring to the event or parameter properly but because I don’t get any errors I have no idea.

using UnityEngine;
using System.Collections;

public class VolumeLookController : MonoBehaviour {

    public GameObject musicBox;
    public GameObject myCamera;
    private float distance;
    float angleAway;
    private FMOD.Studio.EventInstance Music;
    private FMOD.Studio.ParameterInstance LookVolume;

    // Use this for initialization
    void Start () {
        Music = FMODUnity.RuntimeManager.CreateInstance ("event:/Music/Music");
        Music.getParameter ("LookVolume", out LookVolume);

    }

    // Update is called once per frame
    void Update () {

        angleAway = Vector3.Angle(myCamera.transform.forward, musicBox.transform.position - myCamera.transform.position)/180;
        float printOut;
        //LookVolume.setValue (angleAway);
        //LookVolume.getValue (out blegh);

        Music.setParameterValue ("LookVolume", angleAway);
        Music.getParameterValue ("LookVolume", out printOut);

        print (printOut);
    }
}

With this code I’m fed a large stream of numbers confirming that LookVolume is being set to the proper numbers, but the game is unresponsive. Both methods (commented and uncommented) used for setting and printing the value seem to act identically, and neither works properly. What am I missing?

  • You must to post comments
Best Answer
0
0

You are correct about both the methods used for getting and setting the parameter values.

If this is all the code from the script, I believe you are just missing a call:
Music.start();

After creating the instance at some point.

  • You must to post comments
0
0

Maybe i think that, getParameterValue, need to adress value, and you only have on?

RESULT Studio.EventInstance.getParameterValue(
string name,
out float value,
out float finalvalue
);

Music.getParameterValue (“LookVolume”, out printOut, out float finalvalue);

don’t you have an error in Unity Console?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.