I need to play video on iOS but not on the full screen. I have been searching the Google but I found that we can play just full screen video but can not play a video as a texture (movie Texture) of an object as in desktop games.
See the link:
http://docs.unity3d.com/Documentation/Manual/VideoFiles.html
I have found one solution for it. I am using “Maya” software. And made a plane in which I added a texture which comprise of image sequence. and am able to play it by using script
“AnimatedTextureUV.js” .
http://wiki.unity3d.com/index.php?title=Animating_Tiled_texture
It plays the image sequence like a sprite sheet.But my video is stretched at:
var uvAnimationTileX = 24;
var uvAnimationTileY = 1;
and if I make
var uvAnimationTileX = 1;
var uvAnimationTileY = 1;
it shows image in proper ratio and with one tile but do not play image sequence. I don’t know about UV very much. Except uvAnimationTileX <=1 && uvAnimationTileY <=1 it works. But obviously it would show many tiles at a single plane.
anybody please help me.
Thanks
the script i am using is:
var uvAnimationTileX = 24; //Here you can place the number of columns of your sheet.
//The above sheet has 24
var uvAnimationTileY = 1; //Here you can place the number of rows of your sheet.
//The above sheet has 1
var framesPerSecond = 10.0;
function Update () {
// Calculate index
var index : int = Time.time * framesPerSecond;
// repeat when exhausting all frames
index = index % (uvAnimationTileX * uvAnimationTileY);
// Size of every tile
var size = Vector2 (1.0 / uvAnimationTileX, 1.0 / uvAnimationTileY);
// split into horizontal and vertical index
var uIndex = index % uvAnimationTileX;
var vIndex = index / uvAnimationTileX;
// build offset
// v coordinate is the bottom of the image in opengl so we need to invert.
var offset = Vector2 (uIndex * size.x, 1.0 - size.y - vIndex * size.y);
renderer.material.SetTextureOffset ("_MainTex", offset);
renderer.material.SetTextureScale ("_MainTex", size);
}