Problems with 3d Panner using GetEvent()

(Jussi Elsilä) #1


I am using FMOD Studio 1.05.12 and the same unitypackage version on OSX, Yosemite. We are making a 2d-game in Unity. 3D sounds are playing great with PlayOneShot() moderate min & max distance (0.90-50 with default settings) and sounds are fading nicely in and out. Also the FMOD_StudioEventEmitter plays the sounds correctly.
My problem is that when I use GetEvent() all the 3D sound are disappearing and only setting the min and max distance to brainless values (like 550-550) it starts to work. The problem is that, the sound is heard everywhere in scene and tweaking the settings does only effect on sound’s volume.

Here is example of not working script:

using UnityEngine;
using System.Collections;

public class Troll_Sleeping : NPC {

	public static FMOD.Studio.EventInstance troll_snoring;
	public static FMOD.Studio.EventInstance troll_landingHit;
	//public static FMOD.Studio.ParameterInstance troll_snoringTrigger;

	// Use this for initialization
	void Start () {
		troll_snoring = FMOD_StudioSystem.instance.GetEvent ("event:/Trolls/troll_snoring");
		troll_landingHit = FMOD_StudioSystem.instance.GetEvent ("event:/Trolls/troll_landingHit");
//		troll_snoring.getParameter ("Hit", out troll_snoringTrigger);
		troll_snoring.start ();
//		troll_snoringTrigger.setValue (0f);

	public override void Triggered(int TriggerNumber = 0)

		troll_snoring.stop (FMOD.Studio.STOP_MODE.IMMEDIATE);
		troll_snoring.release ();
		//troll_snoringTrigger.setValue (1f);
		troll_landingHit.start ();

Same thing happens when using parameters.

Is there something that I ain’t getting or is this some sort of bug? I remember that this has been working correctly in past.

Thank you in advance!

(Nicholas Wilcox) #2

If you use GetEvent() you must manually set the event position. Use the Event.set3DAttributes() function. Can use the utility function FMOD.Studio.UnityUtil.to3DAttributes() to convert between a Unity Vector3 or GameObject and the FMOD ATTRIBUTES_3D type.

(Jussi Elsilä) #3

Thank you, solved the problem!