how integrate video before menu in unity iphone game

hi i need integrate a video movie introduction before my menu game unity iphone.

how is that posible?

Like @Tetrad said, i created a "iPhoneStreamingAssets"-folder in a new unity-project and imported a *.mp4 video with this code:

function Start() {
    iPhoneUtils.PlayMovie("StarWars.mp4",, iPhoneMovieControlMode.CancelOnTouch);

After that i build and run it on my ipad - but no video playback on the app-start.The movieplayback-control is only 0.5 seconds visible - but no video. Any ideas on that? (i checked my imported video in the inspector with the video-size-format but i cant preview it in the inspector.. is that correctly or does that show that the video file is wrong?)

And a second question: Where are the video-files (from the "iPhoneStreamingAssets"-folder) that unity generates in the xcode project?

Thanks for any help...

Assuming that you have Unity iPhone Advanced, as video is not supported in Unity iPhone Basic, this is how I implemented a video before anything else.

Awake and Start are called pretty much immediately, so the easiest place to put your call is there. It's a basic function call and not much else to it. (I am currently not on my Mac so I can't point you to the class reference)

If you have done that correctly then the video will play immediately. The tricky part though, is that if you play your game and end up coming back to the menu it'll play the video again. Typically you don't want this to happen as it is kind of annoying especially if you don't give a tap to skip option. (which you probably should)

What I did to get around that is check your current time (Time.time) in Awake or Start (ours was 0 because it executed right away), just before you call the video. Add a little leeway for contingency and then do something like this:

if(Time.time < 1)
   //play video code here

Since it will most likely be impossible to skip the video, start playing the game, pause, quit back to main menu in the time it takes your Time.time to increase from 0 to 1 you won't see the video play every time you return to the menu, only on application launch.

Another way to do it would be tell the video to play on Awake inside of a check for a static boolean something like this:

public static bool playVid = true;
void Awake()
       //play video code here
       playVid = false;

This is probably the more simple method.



If you're looking for the way to play a movie (and not just how to do it on startup), look in your hard drive scripting reference for `iPhoneUtils.PlayMovie`

It should be located here: /Applications/Unity%20iPhone/