Hello,
I am trying to get a human projectile to instantiate a sound based on 3 variable ranges. I seem to have the variables updating and changing sound correctly, but the 3D information is not being applied. the sound is in 2D and does not play consistently. It seems quite hard to find up to date information about the scripting API and unity implementation. Here is the code I am using:
public static FMOD.Studio.EventInstance gunfireEvent;
public static FMOD.Studio.ParameterInstance fireSpeed;
public string fire = "event:/Gunfire";
private FMOD.ATTRIBUTES_3D Attributes;
float paramValue;
// Use this for initialization
void Start () {
var rigidBody = GetComponent<Rigidbody>();
var transform = GetComponent<Transform>();
gunfireEvent = FMODUnity.RuntimeManager.CreateInstance (FireBullet);
Attributes = FMODUnity.RuntimeUtils.To3DAttributes (gameObject,rigidBody);
FMODUnity.RuntimeManager.AttachInstanceToGameObject(gunfireEvent, transform, rigidBody);
gunfireEvent.getParameter ("fireSpeed", out fireSpeed);
paramValue = NadeShot.power;
}
// Update is called once per frame
void Update ()
{
gunfireEvent.set3DAttributes (Attributes);
fireSpeed.setValue (paramValue);
gunfireEvent.start ();
Debug.Log (paramValue);
}