Answered
0
0

hello everybody, i can´t call a parameter , what´s wrong??

i´m using FMOD Studio 1.07 and FMOD Studio Integration 2.0 Package Version 1.07.03 and unity 5.2

Code Summary:

using UnityEngine;
using UnityEngine.UI;   
using System.Collections;

public class PlayerController : MonoBehaviour {

    private float pvel; // Unity event for wall impacts
    private FMOD.Studio.EventInstance wallHit; // parameter in FMOD "wall-hit-vel" event 
    private FMOD.Studio.ParameterInstance parameter_name; // fmod parameter



         void FixedUpdate ()

         pvel = gameObject.GetComponent<Rigidbody>().velocity.magnitude;


         void OnTriggerEnter(Collider other)    {
        if (other.gameObject.CompareTag ("wall")) { 
            FMODUnity.RuntimeManager.PlayOneShot("event:/wall"); 
            wall = FMODUnity.RuntimeManager.CreateInstance("event:/parameter_name");

            if (wall.getParameter ("parameter_name", out parameter_name) !=  FMOD.RESULT.OK) {
                Debug.LogError ("parameter bad");
                return;
            }

            parameter_name.setValue(pvel); 
            wall.start();
        }

thankyuo very much.

  • You must to post comments
Best Answer
0
0

I’m not sure of the intention of your code, but I think you need to remove the call the PlayOneShot and the rest should to look something like:

wall = FMODUnity.RuntimeManager.CreateInstance("event:/wall");
wall.getParameter("parameter_name", out parameter_name);
parameter_name.setValue(pvel);
wall.start();
wall.release();
  • You must to post comments
0
0

hello, thank you for your answer , mi intention is how reproduce , one event and one parameter in OnTriggerEnter routine, i was trying with the new scripting in the FMOD Studio integration 2.0 package, but i don´t know how is it, but with the older package works! but with the oldest scripting like FMOD_StudioSystem.instance.PlayOneShot(“event:/pick”, new Vector3(0, 0, 0)); but the second version changed.

please look my complete code.

using UnityEngine.UI;
using System.Collections;

public class PlayerController : MonoBehaviour {

public float speed; 
private Rigidbody rb;                      
private int count;     
public Text countText; 
public Text winText; 
private float pvel;   // player velocity
private FMOD.Studio.EventInstance CreateInstance("event_name"); // how is this with the 2.0 integration package ?

private FMOD.Studio.ParameterInstance wall-hit; // how is this with the 2.0 integration package ?

void Start ()
{
    rb = GetComponent<Rigidbody>();  // player
            count = 0;                      // counts pickups
    SetCountText ();                            // show count
    winText.text = "";                         // winner text

}
void FixedUpdate () 

{
    float moveHorizontal = Input.GetAxis ("Horizontal");  // keyboard  AD
    float moveVertical = Input.GetAxis ("Vertical");          // keyboard WS
    Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
            rb.AddForce (movement * speed);     //apply forces toplayer                          
    pvel = gameObject.GetComponent<Rigidbody>().velocity.magnitude; //calculate player velocity
}                                  

// how i can call event , and the parameter here, with te new package
void OnTriggerEnter(Collider other) //
{
if (other.gameObject.CompareTag (“wall”)) { // player wall hit
wall = FMODUnity.RuntimeManager.CreateInstance(“event:/event_name”);

                    if (pared.getParameter ("parameter_name", out parameter_name) != FMOD.RESULT.OK) {
                   Debug.LogError ("the parameter is not inside event_name");
return;
    }

        wallhit.setValue(pvel); // player velocity in wall-hit parameter
        wall.start();  //reproduce the wall evgent sound
    }

}

void SetCountText ()    // show text in a canvas and compare
{
    countText.text = "Count: " + count.ToString (); 
if (count >= 12) 
    {
        winText.text = "¡¡¡you win!!!";
        FMODUnity.RuntimeManager.PlayOneShot("event:/win_event");
    }
}

}

  • You must to post comments
0
0

hello, thank you for your answer , mi intention is how reproduce , one event and one parameter in OnTriggerEnter routine, i was trying with the new scripting in the FMOD Studio integration 2.0 package, but i don´t know how is it, but with the older package works! but with the oldest scripting like FMOD_StudioSystem.instance.PlayOneShot(“event:/pick”, new Vector3(0, 0, 0)); but the second version changed.
please look my complete code.

using UnityEngine.UI;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private Rigidbody rb;
private int count;
public Text countText;
public Text winText;
private float pvel; // player velocity
private FMOD.Studio.EventInstance CreateInstance(“event_name”); // how is this with the 2.0 integration package ?
private FMOD.Studio.ParameterInstance wall-hit; // how is this with the 2.0 integration package ?
void Start ()
{
rb = GetComponent(); // player
count = 0; // counts pickups
SetCountText (); // show count
winText.text = “”; // winner text
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis (“Horizontal”); // keyboard AD
float moveVertical = Input.GetAxis (“Vertical”); // keyboard WS
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed); //apply forces toplayer
pvel = gameObject.GetComponent().velocity.magnitude; //calculate player velocity
}
// how i can call event , and the parameter here, with te new package
void OnTriggerEnter(Collider other) //
{
if (other.gameObject.CompareTag (“wall”)) { // player wall hit
wall = FMODUnity.RuntimeManager.CreateInstance(“event:/event_name”);
if (pared.getParameter (“parameter_name”, out parameter_name) != FMOD.RESULT.OK) {
Debug.LogError (“the parameter is not inside event_name”);
return;
}
wallhit.setValue(pvel); // player velocity in wall-hit parameter
wall.start(); //reproduce the wall evgent sound
}
}
void SetCountText () // show text in a canvas and compare
{
countText.text = “Count: ” + count.ToString ();
if (count >= 12)
{
winText.text = “¡¡¡you win!!!”;
FMODUnity.RuntimeManager.PlayOneShot(“event:/win_event”);
}
}

}

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.