言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

MovieTexture.audioClip

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public var audioClip: AudioClip;
public AudioClip audioClip;
public audioClip as AudioClip

Description

ムービーテクスチャの AudioClip オブジェクト

動画と常に同期し再生するオーディオは特殊なAudioClipであることに注意してください。 エディタで動画のAudioClipをAudioSourceにアタッチした場合、動画を再生すると自動でAudioClipも再生されます。 そうでなければ、動画を開始した時に手動で開始させる必要があります。 クリップは1つのAudioSourceにのみアタッチすることができます。 See Also: Play, WWW.movie.

	var url = "http://www.unity3d.com/webplayers/Movie/sample.ogg";
	function Start () {
		// Start download
		var www = new WWW(url);

		// Make sure the movie is ready to start before we start playing
		var movieTexture = www.movie;
		while (!movieTexture.isReadyToPlay)
			yield;


		// Initialize gui texture to be 1:1 resolution centered on screen
		guiTexture.texture = movieTexture;

		transform.localScale = Vector3 (0,0,0);
		transform.position = Vector3 (0.5,0.5,0);
		guiTexture.pixelInset.xMin = -movieTexture.width / 2;
		guiTexture.pixelInset.xMax = movieTexture.width / 2;
		guiTexture.pixelInset.yMin = -movieTexture.height / 2;
		guiTexture.pixelInset.yMax = movieTexture.height / 2;

		// Assign clip to audio source
		// Sync playback with audio
		audio.clip = movieTexture.audioClip;

		// Play both movie & sound
		movieTexture.Play();
		audio.Play();
	}
	// Make sure we have gui texture and audio source
	@script RequireComponent (GUITexture)
	@script RequireComponent (AudioSource)