Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

MovieTexture problem

Discussion in 'Scripting' started by Serellyn, May 16, 2013.

  1. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    Okay, so, a question because I'm a bit stuck.
    It's really weird, I have a movie on a location that I want to play. This is just for testing purposes, so I'm using a static location of the video. And I'm using the following code;

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class Main : MonoBehaviour {
    6.    
    7.     private MovieTexture idlescreen_movie;
    8.     private bool movieloaded;
    9.    
    10.     // Use this for initialization
    11.     void Start () {
    12.         StartCoroutine(GetIdlescreenFromLocation());
    13.     }
    14.    
    15.     IEnumerator GetIdlescreenFromLocation() {
    16.         WWW idlescreen_location = new WWW("***/sonar_idlescreen_movie.ogv");
    17.         yield return idlescreen_location;
    18.         idlescreen_movie = idlescreen_location.movie;
    19.        
    20.         movieloaded = true;
    21.     }
    22.    
    23.     void OnGUI() {
    24.         if(movieloaded) {
    25.             GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),idlescreen_movie);
    26.             idlescreen_movie.Play();
    27.             idlescreen_movie.loop = true;
    28.         }
    29.     }
    30. }
    31.  
    32.  
    Now, the problem is that I'm not getting the movie. The path is correct and I do not get an error or anything. But the movie is not playing either.

    In the editor, I even get weird text in the left corner. In a build of this the screen just goes black.

    Does anyone have an idea what could be wrong?
     
    Last edited: May 16, 2013
  2. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    And yes, I have a pro license :)
     
  3. Serellyn

    Serellyn

    Joined:
    Sep 30, 2011
    Posts:
    104
    Okay, nevermind! I should pay more attention to detail. Since it's a local file I should've put "file://" in front of the path!
    A workout and some food does miracles at times.