I have a movie texture mapped to a monitor and it plays just fine in the editor. When I create a build either standalone or webplayer, the movie or sound do not play. Here is the code for playing back the movie. I have an audio file attached to the monitor. I have Unity Pro. Any help please?
var movieTexture : MovieTexture;
function Start() {
movieTexture.loop = true;
renderer.material.mainTexture = movieTexture;
movieTexture.Play ();
}
This problem isn’t solved yet.
In the editor, if I click on the movie and play it in its tiny window, then the sound of the movie will play correctly in the editor afterword. But if I build an exe, then the sound is always mute. I have to drag the sound into scene and use
GameObject.Find(“test1 audio”).audio.Play();
to play the sound. Is there any better way to play a movie with synced sound?
It is hard to tell what is happening here without seeing what is going on. Can you attach a minimal project folder to demonstrate the issue? That should help giving a more specific reply to this issue.
here is the example…
if I play the movie on the inspector’s preview window, then I can hear sound afterwords. But when I create the exe file, there won’t be any sound.
Ok, I just checked this out. The fact that you hear sound in the editor is a bug. The standalone player’ behavior is correct. You should only hear sound, when you add the movie’s AudioClip to an AudioSource in the scene. The simplest way to do this is just to drag the movie’s audio to the scene.
Now, when you play the movie in the preview, Unity creates a temporary Audio Source to play back the movie audio, which is then (wrongfully) playing back the audio from the scene as well, which is misleading, because it suggests that no AudioSource is needed for the movie. I will file a bug on this, so it gets fixed in a future build.