Search Unity

WWW trying to display a video from server onto a texture.. help

Discussion in 'Immediate Mode GUI (IMGUI)' started by djgriff, Apr 20, 2015.

  1. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    Hi i have followed the example from the on unity api for www and amended it to display a movie texture, but it isn't working, I am new to unity and c# as i am coming from java. also pretty new to coding altogether.
    However any suggestion help would be awesome.

    1. i have created a plane
    2. added a PlayMovie.cs to the plane
    3. run with no errors. screen waits then just turns black where the plane is..

    Think i am doing something fundamentally wrong..

    using UnityEngine;
    using System.Collections;
    [RequireComponent (typeof(AudioSource))]
    public class PlayMovie : MonoBehaviour {

    public MovieTexture movieTwo;
    public string url = "http://www.mindfulness-health.co.uk/test/one.ogv";
    WWW www;

    IEnumerator Start () {

    movieTwo = new MovieTexture();
    www = new WWW(url);
    yield return www;
    movieTwo = www.movie;

    GetComponent<Renderer>().material.mainTexture = movieTwo;
    movieTwo.Play();
    }
    }

    Any help appreciated

    Thanks
     
    Last edited: Apr 20, 2015
  2. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    Ha got it working.. anyone know how to get sound working?