Answered
0
0

hello, when i erase the 3d the sound is ok, but when i put tthe 3d panner, there is no sound, why?

enter image description here

run the code and the sound is ok! but…

enter image description here

enter image description here

no sound! when the player moves until the 3d space :(
even when the enemy is not moving. and whe i assign a built in distance parameter.

  • Joseph Harvey

    By default, our unity integration attaches the listener to the camera. Your game seems to use third-person perspective; If you want the audibility of events to be based on the player’s position, you need to attach the listener to the player. Have you done this?

  • You must to post comments
Best Answer
0
0

Yes! that is the solution! it works. thank you Joseph Harvey.

but i have another problem, that work if a have the sound in a Studio Event Emitter, but when i use the script something missing, maybe activate the 3d panner in the script, but how?

the script

using UnityEngine;
using System.Collections;

public class EnemyMovement : MonoBehaviour
{
Transform player;
PlayerHealth playerHealth;
EnemyHealth enemyHealth;
NavMeshAgent nav;

[FMODUnity.EventRef]
public string Playerstate2 = "event:/Music";

void Awake ()
{
    player = GameObject.FindGameObjectWithTag ("Player").transform;
    playerHealth = player.GetComponent <PlayerHealth> ();
    enemyHealth = GetComponent <EnemyHealth> ();
    nav = GetComponent <NavMeshAgent> ();
}


void Update ()
{

    FMODUnity.RuntimeManager.PlayOneShot (Playerstate2 );
    if(enemyHealth.currentHealth > 0 && playerHealth.currentHealth > 0)
    {
        nav.SetDestination (player.position);
    }
    else
    {
        nav.enabled = false;
    }
}

}

if i use the 3d panner not work , only in the studio event emmiter. if i erase the 3d panner doesn´t sound.

  • Nicholas Wilcox

    Use

    FMODUnity.RuntimeManager.PlayOneShot(Playerstate2, transform.position);

    to play the sound at the objects current location.

    Use

    FMODUnity.RuntimeManager.PlayOneShot(Playerstate2, gameObject);

    to have the sound follow the game object position for the duration of the event.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.