Sunday, June 26, 2011

How to trigger a cutscene movie?

This idea captured from Unity Answers forum

=========================================================================
Currently i have a trigger that when my player moves into a hidden object a new scene is loaded, heres the code for that:
==============================================================================

var 1;
function OnTriggerEnter (other : Collider) {
if (other.gameObject.CompareTag("Player")) {
Application.LoadLevel(1);
}
}

=============================================================================
However i would like a cutscene (a simple MOV file) to play full screen after the player has triggered the event but before they have entered this new level.` (An example of this is a cutscene of a boss crashing through trees and arriving at your location, in this new scene you will need to fight this boss)
Also, if i'm not pushing it, i would like to know how to get a MOV file to play before the game is loaded, for example an intro cutscene.

==================================================================================
Answer Algorithm
==================================================================================
You can create a new scene (for Application.LoadLevel) and execute this MovieTexture function on Load:
function Start () {
renderer.material.mainTexture.Play ();
}

========================================================================================
To start loading the level in the background, use the Application.LoadLevelAsync function

if you don't have Unity pro, would be great if you could help me over at my new question:http://answers.unity3d.com/questions/9030/movie-playback-any-way-to-get-around-not-having-unity-pro would be great, 





No comments:

Post a Comment