Skip to main content

Ready to market your stellar app?

Samsung Developer Program is your gateway to app monetization success.

Learn More

Samsung Developer Program

Step 3: Create the StartApp Object


In this step, you create a StartApp object to create a timer that tells the app how long the splash scene should be displayed before switching to the main scene.

For other steps in this exercise, see Exercise 3: Connect Two Scenes.


To create the StartApp object: 

  1. From the Property view, open the /Assets/Workshop/Scenes/Splash.unity file.


  1. From the Hierarchy view, select Create > Create Empty.


  1. From the Inspector view, change the name of the object from GameObject to StartApp and press Enter to save the change. You will use this empty object to create a timer that tells the app how long the splash scene should be displayed before switching to the main scene.


  1. Click the Add Component button and select Scripts > Start App. This will add the Start App script as a component of the StartApp game object you created. 


  1. From the Start App component, double-click the StartApp script to open the file in MonoDevelop, Unity's code editor, where you can further inspect the script.


  1. From MonoDevelop, review the StartApp script. You will notice that several variables are defined at the top of the script file. The public variables in the script are customizable in the Unity UI, while the private variables are not. This is useful when working on a project with several people. A developer can set the variables in the code, allowing designers to tweak the properties as needed within Unity. You will also notice that this script file, along with all of the other provided scripts for app, have been thoroughly commented, giving you details on how each element contributes to the app.


  1. Close MonoDevelop and return to Unity.


  1. From the Unity menu, select File > Build Settings.


  1. From the Project view, drag the /Assets/Workshop/Scenes/Main.unity file into the Build Settings window. Each scene in your app is given an index number. Scenes with an index value of 0 are displayed first, scenes with an index of 1 are displayed second, and so on. In this app, the first scene that will be displayed is the splash scene.


  1. Close the Build Settings window. 


  1. Review the Start App component in the Inspector view. This script sets the duration of the splash scene to 2.5 seconds and tells the app to switch to the scene with an index value of 1 - the main scene.


  1. Extend the duration of the splash scene by changing the MSplash Duration property to 5 seconds.


  1. Save the scene.


  • Was this article helpful?