Core API playing a sound

Hi,
So I’ve been using FMOD Studio for a long time, but for a new game that I am working on I want to use the core API. I have been having some trouble being able to play the first sound. My code compiles fine, but I don’t hear anything and can’t seem to find out where it’s going wrong.

Could anyone tell me what I am doing wrong / not understanding?

    var corSystem = FMODUnity.RuntimeManager.CoreSystem;
    uint version;
    corSystem.getVersion(out version);

    Sound sound;
    corSystem.createSound("filename.wav", MODE.DEFAULT, out sound);

    ChannelGroup channelgroup;
    corSystem.createChannelGroup("master", out channelgroup);

    Channel channel;
    corSystem.playSound(sound, channelgroup, false, out channel);

Thanks!

If your wav file is inside the assets folder the correct path would be “Assets/filename.wav”. In any case you can check what createSound returns, if it can’t find the file it will return ERR_FILE_NOTFOUND:

    Sound sound;
    var result = corSystem.createSound("Assets/filename.wav", MODE.DEFAULT, out sound);
    UnityEngine.Debug.Log(result);
2 Likes

Thanks the issue was indeed the path! I wrongly assumed the path would be relative to the class