- Home /
3D Sound Max Distance Not Working.
Here is my problem... When I hit play on my scene I have a quad that shows a video and plays that videos audio. The problem is the 3D settings are not working until I change a value of the audio source inside of the editor while playing. After I do that, the 3D settings work without a problem. So I tried to do that in code, but it didn't help.
I have a quad in my scene and that quad has my script plus an audio source on it. The audio source's clip is set by my script and these are the following settings of my audio source:
AudioClip: None (I will set this later on in my script)
Mute: false
Bypass Effects: false
Bypass Listener Effects: false
Bypass Reverb Zones: false
Play On Awake : false
Loop : true
Priority: 128
3d settings
Doppler Level : 1
Volume Rolloff: Linear
Min Distance : 1
Pan Level : 1
Spread : 0
Max Distance : 3
2d settings
Pan 2D: 0
and here is my script:
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(AudioSource))]
public class TempVideoPlayer : MonoBehaviour
{
public string url = "http://becunningandfulloftricks.files.wordpress.com/2013/04/hedgehog_in_the_fog.ogg";
private MovieTexture movieTexture;
// Use this for initialization
void Start ()
{
// Start download
var www = new WWW (url);
// Make sure the movie is ready to start before we start playing
movieTexture = www.movie;
movieTexture.loop = true;
StartCoroutine (CheckMovieStatus());
}
// Update is called once per frame
void Update ()
{
}
IEnumerator CheckMovieStatus ()
{
while (movieTexture.isReadyToPlay == false)
yield return new WaitForSeconds(0.1f);
renderer.material.mainTexture = movieTexture;
audio.clip = movieTexture.audioClip;
// Play both movie & sound
movieTexture.Play ();
audio.Play();
}
}
Your answer
Follow this Question
Related Questions
Loading ogg though WWW results in 3D Sound, need as 2D... 3 Answers
Sound getting deeper 2 Answers
Audio mixed, blending on distance ? 1 Answer
Audio Not Always Playing 3 Answers
Volume rolloff: Distance to listener not changing. 3 Answers