Project 2 - Starter Assets

For the remaining projects in this course, we'll use the following provided script files:

Scripts: StateManager.cs - Custom State Machine Logic - Inherits from MonoBehaviour IStateBase.cs - Interface specification BeginState.cs - Example Scene-State script EndState.cs - Example Scene-State script

Scenes: BeginScene, EndScene

  • Each scene contains:

    • UI Button, UI panel with UI - Text

Instructions - Create Project 2:

  1. Find your Project1 Unity files on your computer

  2. Create a copy of your Project 1 Unity Project.

  3. Rename your duplicate project to reflect: Project2

  4. Open Project2 in Unity

  5. Save Project2 in Unity

Import downloaded custom package into Unity

  1. Download the Project2 StarterAssets UnityPackage using links above.

  2. Import into Unity: Menu > Assets > Import Custom Package

    1. browse to your downloaded file

    2. Import all items

BeginScene: GameManager

In the BeginScene, create an empty GameObject called: GameManager, add the StateManager script as a Component to this GameObject Note when the scene is played, the GameManager will show as DontDestroyOnLoad in the Hierarchy Panel

Add Scenes to Unity Build Settings

  1. Go to File / Build Settings (see image below)

    1. Drag BeginScene, EndScene into Scenes In Build panel

    2. Do not Build Project

    3. Close Build Settings Window

  2. In Unity, open BeginScene, Play, use buttons to change between BeginScene, EndScene

Play the Game

If you've done the above steps correctly, you should be able to use the EndButton to go to the EndScene, and from there, you should be able to use the StartButton to return to the StartScene.

Problems with TitlePanel and TitleText Display

Sometimes Unity acts glitchy with UI-Panels and UI-Text gameObjects. If the TitlePanel and TitleText aren't displaying correctly, select the TitlePanel in the hierarchy and then select the rect-transform tool which shows the positioning blue circles at the corners of the panel. Try dragging the top blue circles below the bottom circles to see if the panel has flipped backwards. Also try dragging the left corners over the right corners. This may also be necessary to do with the text element. If these efforts don't fix the problem, simply delete the panel and add new panel / text gameObjects to recreate the corrupted gameObjects.

Last updated