Answered
0
0

In Fmod in folder Music I have event “Music” with parameter “Game”. In event “Music” I have 5 event sounds. One of them is “Mario” with 3 parameters “Lead”, “Bass”, “Drums”. I have it implemented in Unity5.

public class MusicScript : MonoBehaviour {

    private FMOD.Studio.EventInstance musicEvent;
    private FMOD.Studio.ParameterInstance Game;

    void Start () {

        musicEvent = FMOD_StudioSystem.instance.GetEvent ("event:/Music/Music"); 

        if (musicEvent.getParameter ("Game", out Game) != FMOD.RESULT.OK) {
            Debug.LogError ("Can't find Game parameter on the event");      
        }

        musicEvent.start(); 
    }

    void OnTriggerEnter (Collider other) {

        if (other.tag == "Green") {
            Game.setValue (1);
        }
        if (other.tag == "Blue") {
            Game.setValue (2);
        }
        if (other.tag == "Yellow") {
            Game.setValue (3);
        }
        if (other.tag == "Pink") {
            Game.setValue (4);
        }
        if (other.tag == "Red") {
            Game.setValue (5);
        }
    }
    void OnTriggerExit (Collider other) {
        if (other.tag == "Green" || other.tag == "Blue" || other.tag == "Yellow" || other.tag == "Pink" || other.tag == "Red") {
            Game.setValue (0);
        }
    }
}

That works. I’ve done it before. The problem is that I don’t know how to get to e.g. parameter Lead in Mario event sound in Music event. It’s not other event but a child of it.

  • You must to post comments
Best Answer
0
0

If you add “Lead”, “Bass”, and “Drum” as parameters to the parent event they can be set in-game and the value will be propagated down to the sub event.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.