ムービーテクスチャの使い方


ゲーム内での動画の再生・停止
using UnityEngine;
using System.Collections;
public class movie : MonoBehaviour {
public AudioClip movieSound;
void Update () {
// 今回はキーボードの「M」キーで動画のオン・オフを切り替える。
if(Input.GetKeyDown(KeyCode.M)){
Renderer ren = GetComponent<Renderer>();
MovieTexture movie = (MovieTexture)ren.material.mainTexture;
if(movie.isPlaying){
movie.Pause();
} else {
movie.Play();
AudioSource.PlayClipAtPoint(movieSound, Camera.main.transform.position);
}
}
}
}
Unity Code Memo
他のコースを見る

ゲーム内での動画の再生・停止
using UnityEngine;
using System.Collections;
public class movie : MonoBehaviour {
public AudioClip movieSound;
void Update () {
// 今回はキーボードの「M」キーで動画のオン・オフを切り替える。
if(Input.GetKeyDown(KeyCode.M)){
Renderer ren = GetComponent<Renderer>();
MovieTexture movie = (MovieTexture)ren.material.mainTexture;
if(movie.isPlaying){
movie.Pause();
} else {
movie.Play();
AudioSource.PlayClipAtPoint(movieSound, Camera.main.transform.position);
}
}
}
}
ムービーテクスチャの使い方