- Home /
 
 
               Question by 
               TheRichardGamer · Jul 09, 2015 at 08:47 PM · 
                c#errormovietextureplayback  
              
 
              How do I pass on a movieTexture through a function to another script in another scene?
I've tried having the playMovie function static but that just gives me errors and I don't know what to do about it.
Here are my two separate scripts:
 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 
 public class Commands : MonoBehaviour 
 {
     public GameObject textObj;
     public string textInput;
 
     public MovieTexture postbanken;
 
     void Start ()
     {
 
         DontDestroyOnLoad(this);
 
     }
 
     void Update ()
     {
 
         textInput = textObj.GetComponent<Text>().text;
 
         if(Input.GetKeyDown(KeyCode.Return))
 
         {
 
             char quotes = '"';
 
         if(textInput == "play " + quotes.ToString() + "Postbanken" + quotes.ToString())
         {
 
             Debug.Log ("Now playing 'Postbanken' ");
                 Application.LoadLevel("videoPlay");
 
 
         }
 
         
 
 
         }
 
     }
 
 }
 
 using UnityEngine;
 using System.Collections;
 
 [RequireComponent (typeof(AudioSource))]
 
 public class PlayVideo : MonoBehaviour 
 {
  
     public bool hasStarted;
     public bool videoIsPlaying;
 
     public void playMovie (MovieTexture videoFile)
     {
 
         this.gameObject.GetComponent<Renderer>().material.mainTexture = videoFile as MovieTexture;
         
         this.gameObject.GetComponent<AudioSource>().clip = videoFile.audioClip;
         videoFile.Play();
         this.gameObject.GetComponent<AudioSource>().Play();
         
         
         videoFile.loop = false;
         hasStarted = true;
         videoIsPlaying = true;
 
     }
 
     void Update ()
     {
 
         if(Input.GetKeyDown(KeyCode.Escape))
         {
 
             Application.LoadLevel("CommandLine");
 
         }
 
         if(videoIsPlaying == false && hasStarted == true)
         {
             
             Application.LoadLevel("CommandLine");
             
         }
 
     }
 
 }
 
 
              
               Comment
              
 
               
              I don't understand what you do here. I think it needs some better explanations. For example on what the script are attached, what is the problem, errors given?
Your answer
 
             Follow this Question
Related Questions
Unity3D MovieTexture Loop 0 Answers
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Array member treated as null even though it is not. 1 Answer
Open door = load scene c# issues 4 Answers