Splash screen video from the start of a game


(Nathaniel Millett) #1

Hey guys,

Like the topic title suggest, I’d like to immediately play a MP4 when the game starts that is then followed by a main menu.

I’m aware that with the recent update people have suggested this is achieved by using a scene with blox however I was hoping someone could give/show some examples of how this would look in a hierarchical layout.


#2

Heres a sample file for you along with a script that shows you how to go about playing a movie texture and sound on a UI Canvas for your splash image.

Included is a sample movie clip (royalty free), the attached sound file, and a demo scene.

In the demo just press “E” to start the movie.

DOWNLOAD


(Nathaniel Millett) #3

Thank you sir!


(Nathaniel Millett) #4

The package worked perfect. Is there an autoplay feature?


#5

Yea just change the:

void Update () {

to

void Start() {

and remove the:

if (Input.GetKeyDown("e"))
{
}

But keep the insides:

MovieTexture movie = GetComponent<RawImage>().texture as MovieTexture;
            
GetComponent<AudioSource>().Play();
movie.Play();    
            
print("Movie has stared");
            
Invoke("ChangeScene", delay);

(Leslie Young) #6

I moved the post since it seems to be related to plyGame and plyBlox. The Blox category is for the stand-alone “Blox Visual Scripting” system.


#7

Hi,
Thanks for posting this, but when I play this scene I get:

NullReferenceException: Object reference not set to an instance of an object
PlayMovie.Update () (at Assets/Movie/PlayMovie.cs:18)

How do you tell it to play SampleVideo_1080x720_2mb.mp4

I can’t see anywhere on ‘My Movie’ inspector to do that.


#8

I found additional info that is needed to make it work:

http://forum.unity3d.com/threads/using-a-movie-texture-with-ugui.270010/

Install Apple QuickTime
http://docs.unity3d.com/Manual/class-MovieTexture.html

In the demo.unity scene, add an empty game object and add a Blox component to it. In its BloxEd add ‘On State Enter’ event, then add HideAllScreens function to that event. You may need to remove the Audio Listener component from the Main Camera in the demo.unity scene. In ScreenEd > Language Screen, set the demo.unity to be the scene …to show next.

Don’t forget to press e to make it play.


#9

Yea. I assumed you had quick time installed.


#10

I’m a Unity newbie and built a new computer recently. So yeah…