- Home /
Movie Texture running choppy at random times
Hello! I made a simple 2D Pong in Unity and I wanted to put an animated background to it. I noticed that the animated background tends to run choppy every few seconds. Basically it looks as if your FPS dropped while playing. I checked the FPS and it's 60-120 so that isn't the issue. The video is only 14 seconds long and keeps looping. The file is 7MB and in .OGG format. I tried lowering the bitrate and changing it from 1080p to 720p but it's still the same. It plays completely smooth in any video player. The movie texture is attached to a Mesh Renderer and I use the following script to play and loop it:
var movTexture : MovieTexture;
function Start () {
movTexture.loop = true;
renderer.material.mainTexture = movTexture;
movTexture.Play();
}
You can also download the game from here and see the how the background runs: https://mega.co.nz/#!lJw1SBCJ!XuBcRSZxuUbIhklFgMroqIn2yWFEfpZmp1S7ss00bh4
Anyone knows how to make it play smooth as it does in the video player?
Answer by Graham-Dunnett · Nov 13, 2014 at 09:45 PM
Movie textures are decoded in software, with each decoded frame uploaded to the GPU as a texture. These decoded frames can obviously consume memory. Video players will upload the compressed frames to the GPU and use the GPU to do the decoding.
Is there a way to stream the animated background from disc? If so, would that help?
Answer by PedramGC · Aug 10, 2016 at 07:52 PM
I "fixed" it by changing the resolution to something lower and after the video is done playing going back to whatever resolution it was using. It don't fix the issue entirely but makes it much better. The lower the resolution the better it plays, but at the cost of reduced quality.