キー オブジェクトを使用してユーザーにビデオ テクスチャをロードする Unity Pro 用のスクリプトを作成しようとしています。次のコードを使用すると、「NullReferenceException: オブジェクト参照がオブジェクトのインスタンスに設定されていません」などのさまざまなエラーが発生します。
#pragma strict
static var isPlay : boolean = false;
function OnTriggerEnter (other : Collider) {
if(other.CompareTag("key")) {
print("Key!\n");
isPlay = true;
}
}
var movTexture : MovieTexture;
function Update() {
if(isPlay) {
movTexture = Resources.Load("VideoScraping/VidsList/20130324003252.mp4") as MovieTexture;
renderer.material.mainTexture = movTexture;
movTexture.Play();
}
}
リソースをロードするために私がしなければならないキャストの別の形式はありますか? ムービーの読み込み方法は異なりますか? ここに私が見逃している別の要素はありますか?