Any possibility to play a video in unity free?

^ This.

Thanks in advance

h4wkeye

I wrote a script wich reads out all pictures out of a folder. You can use Virtualdub to make your clip to pictures, load the folder into unity 3d and then type in the name of the folder in the script. The script looks like this.

#pragma strict
var imageFolderName = "";
var MakeTexture = false;
var pictures = new Array();
var loop = false;
var counter = 0;
var Film = true;
var PictureRateInSeconds:float = 1;
private var nextPic:float = 0;

function Start () {
    if(Film == true){
	    PictureRateInSeconds = 0.04166666666666666666;
    }

	var textures : Object[] = Resources.LoadAll(imageFolderName);
	for(var i = 0; i < textures.Length; i++){
	    Debug.Log("found");
	    pictures.Add(textures*);*
  • }*
    }

function Update () {

  • if(Time.time > nextPic){*
    nextPic = Time.time + PictureRateInSeconds;
    counter += 1;
  •  if(MakeTexture){*
    

renderer.material.mainTexture = pictures[counter];
}

  • }*
  • if(counter >= pictures.length){*
  •  Debug.Log("fertig");*
    
  •  if(loop){*
    
  •      counter = 0;*
    
  •  }*
    

}
}
you have to create a Resources folder and put the folder with the pictures into that folder. But it works great!

Hi, h4wkeye.

I wrote a script that does just that and more. You can find it in the asset store under the name “Universal Video Texture”. Also with my script you’re not limited to just a short video clip. Works perfectly with Unity free, web, ios and and Android.

Here’s the link: Universal Video Texture | Tools | Unity Asset Store

Have fun!

Royie

If it's a short video, you can render out each frame to an individual texture and cycle through the textures through code at whatever frame rate you need.

With Unity 5 (free, personal edition), MoviewTexture seems working, although online manual denoted that MovieTexture is “Pro/Advanced only feature” yet, and it seems work only with .ogv (OGG Theora) format file (not working with .mp4, .mov file in my env).

I’m not sure it is defect of the Unity 5 editor, or is spec. but with the following steps the MovieTexture worked in my environment:

  1. import .ogv file into unity project
  2. drag&drop the .ogv file to a Plane, to assign the movie as the texture.
  3. write a script using MovieTexture.Play() method as described in script reference, to play the movie

Video support is limited to Unity Pro. If you are targeting the web player, you can show video using other plugins (QuickTime, Flash), and switch between them using JavaScript, though.

For The People Using Unity 5
This answer is based on @arky25’s but uses a GUItexture instead if you want to cover the whole screen. It is in javascript.

#pragma strict
var imageFolderName = "";
var MakeTexture = false;
var pictures = new Array();
var loop = false;
var counter = 0;
var Film = true;
var PictureRateInSeconds:float = 1;
private var nextPic:float = 0;
 
function Start () {
	if(Film == true){
		PictureRateInSeconds = 0.03;
	}

	var textures : Object[] = Resources.LoadAll(imageFolderName);
	for(var i = 0; i < textures.Length; i++){
		pictures.Add(textures*);*
  • }*
  • GetComponent.().Play();*
    }

function Update () {

  • if(counter >= pictures.length){*
  •  if(loop){*
    
  •  	counter = 0;*
    
  •  }*
    
  • }*
  • if(Time.time > nextPic){*
  •  nextPic = Time.time + PictureRateInSeconds;*
    
  •  if(MakeTexture){*
    
  •  	GetComponent.<GUITexture>().texture = pictures[counter];*
    
  •  }*
    
  •  counter += 1;*
    
  • }*
    }

i think the best answer for that is Handheld.PlayFullScreenMovie(VideoPath);

Make a Folder Named StreamingAssets inside of Assets Folder and Place your video in that folder. eg. That Video’s name is Test.mp4

now all you have to do is to Write this Code

Handheld.PlayFullScreenMovie("Test.mp4");

@h4wkeye
@shuichi_saitoh
@kahalany
@Jason H