Is there a reliable way to rewind a movie texture? (Without then playing the movie)
stop() doesn't do it, and play() then stop() doesn't do it.
Is there a reliable way to rewind a movie texture? (Without then playing the movie)
stop() doesn't do it, and play() then stop() doesn't do it.
You might want to check out the QT plugin in the wiki. It has more comprehensive video playback controls. It is harder to use though and requires unity pro.
Alternatively, you might be able to restart the video using a secondary material that is hidden off screen and juggling the materials...
I can confirm this bug. It happens both in editor and in the built versions. It doesn't happen the very first time you execute the script though, that's why a just-built version seems to not have the bug. If you re-load the scene again, it also won't happen in editor.
I'll describe the only workaround I found. Bear in mind that I'm trying to reset and play an animation that starts with a fully black frame to be used as fully transparent in an movie texture alpha channel. I use a play+pause then yield twice in the start block, I found that two yields is the minimum to get this to work. If your mov is at 30 FPS you'll need at least 4 frames of headroom at the start of your movie, if you want to "fade it in". In my case I use 60 FPS so I've added 8 extra starting black frames in After Effects. Follows the code I've used:
function Start () {
mask = renderer.material.GetTexture ("_Mask");
mask.Stop();
mask.Play();
yield; yield; // Every yield = ~2 .mov Frames @ 30 FPS;
mask.Pause();
}
function Update () {
if (Input.GetButtonDown ("Jump")) {
mask.Play();
}
}
GLHF!
In my experience the movie texture behaves differently when used in the editor and in a compiled game. So try and use the Stop() method and see how it behaves if you build a standalone version. If I remember correctly it works as documented when used outside of the editor.
I cannot reproduce this in either 2.6.1 or current builds - (using Stop() and then Play()). Could you file a bug report with an example project on how to get to this issue, so we can fix it?