For all Unity developers and developers-to-be, both beginners and professionals!

Post news Report RSS Using Unity Free to create a seamless level change with a pre-rendered cutscene

Kitatus Studios release a tutorial on how they managed to create a scene changer which involves a pre-rendered cutscene in Unity Free to help other developers who may be in a similar boat in their current or future projects.

Posted by on

Hi there Guys 'n gals,
Today we're gonna be talking through what we did in Unity to manage a scene transition to a cutsccene and then over to another scene after the cutscene finished playing in Unity Free.

Here is a video of the final product of this tutorial:

From design to implementation, here is how I managed to pull this off in Unity free.

So, to start things off, Here is the original plan I had, expertly crafted in Paint, the king of Image Creation tools:


As you hopefully can see, the idea is simple. When a player enters a portal, it triggers a cutscene and then loads the next scene when the cutscene is over.

So we had the plan, we just had to figure out how to pull it off. We had "Application.LoadLevel();" but we needed a way to trigger this. So we did it the old fashion way and added a simple box collider to the scene (Create > Other > Cube). removed the mesh (Under mesh Filter, Highlight Cube and hit backspace), clicked "Is Trigger" in the box collider properties and set the tag/layer to "Port".

An image of these steps can be found here: CLICK ME.
Once we made the collider, we headed over to the Asset Store, to get our hands on Screen Fader, An asset which makes Screen Fading possible. Following the instructions in the Asset, we configured the fade out to our personal specifications and popped it into the scene.

So we had the collider and the screen fader all in the scene, but how do we make this transition into a movie file (Especially when using Unity Free)? Well, heading over to the main character in our scene, we added this script to the character:

c code:
public class YOURNAMEHERE : MonoBehaviour
{
  IEnumerator OnTriggerEnter (Collider other){
 
    if (other.gameObject.name == "port")
    {
      Fader.Instance.FadeIn();
      yield return new WaitForSeconds (1);
      {        Application.LoadLevel("YOURLEVELNAMEHERE"); 
      }
    }
  }
}

We tested the scene and BAM, it changes to the next level after the fade. It's cool and all, but we wanted a movie to play after the fade. So in the new Scene ("YOURLEVELNAMEHERE"), we need to put video. But we're on Unity free. No problem. We downloaded the free Asset "Universal Video Texture Lite". The way this works is by using images of your video. Don't worry, it still plays perfectly like a video but uses tricks to get past Unity's Pro wall. To turn our video into images.

We converted our video file to . mov (Using Xilisoft's Video Converter Ultimate but there are plenty of free options available). Once all converted up, we headed to QuickTime Pro (There are plenty ways to do this, by the way, this is just the way we did it) and hit File > Export.

From here, it was a "Save as Image sequence" job (MAKE SURE YOU SELECT THE CORRECT FPS), and we had the files ready for the Universal Video Texture Lite.

All we need now is Audio! So we headed back over to Xilisoft's Video Converter Ultimate and made sure to convert the video into .mp3 (Using the same file name).

So we have everything we need, let's put it all together. I followed the tutorial in Universal Video Texture Lite and before I knew it, we had a full video and audio playing in the scene. Perfect! But at the end of the video, we're stuck in the video's black screen. How do we get around this? With this script! We checked the original video file to see how long we needed time-wise (21 seconds) and BAM!

javascript code:
#pragma strict

function Start () {
Invoke("nextScene", 21);
}
 
function nextScene () {
Application.LoadLevel("NEWLEVEL");
}

Then, just to confirm everything works, we build the project and ta-da! A seamless transition to the next scene with a cutscene in between!

If anything doesn't make sense or you need some clarification on anything, feel free to shoot me an email: contact@kitatusstudios.co.uk and I'll guide you as best I can with a video or something on how we did it all.

Thanks for reading and best of luck in all of your projects guys 'n gals!
- Ryan S, Project Lead

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: