# 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**

![Make a Duplicate of your Project1 Unity Files](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-MHwXFc8cFgVW3a-Gz9Q%2F-MHw_NxW-MOLnXkyCV3J%2FScreen%20Shot%202020-09-23%20at%201.04.44%20PM.png?alt=media\&token=b06b2574-ecc4-4b43-9bff-f99be2ba120c)

![Rename to create Project2 Unity Files](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-MHwXFc8cFgVW3a-Gz9Q%2F-MHw_QuSPpWggND0muwT%2FScreen%20Shot%202020-09-23%20at%201.05.05%20PM.png?alt=media\&token=be430d75-5c43-4fc7-8cf7-38b3b55e00f0)

### Import downloaded custom package into Unity&#x20;

### **Download:**  [**Starter Code - Unity Package** ](https://utdallas.box.com/s/zr26w7qqu5lng2ymgbs578uaznbwpmic) **- Box.com**

1. Download the Project2 StarterAssets **UnityPackage** using links above.
2. Import into Unity: **Menu > Assets > Import Custom Package**   &#x20;
   1. browse to your **downloaded file**&#x20;
   2. **Import all items**

![Import Custom Package](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-MHw_e0HwKnfB4zTnQvv%2F-MHwa6liAxRfzlXyNqLX%2FScreen%20Shot%202020-09-23%20at%203.11.45%20PM.png?alt=media\&token=36da0ed3-6bd8-48cb-aa51-b728c56d8eb5)

![Import All](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-MHw_e0HwKnfB4zTnQvv%2F-MHwaoi5WqPXB6yc02V9%2FScreen%20Shot%202020-09-23%20at%203.14.59%20PM.png?alt=media\&token=388caf56-d22a-494a-a2fe-a265ef6d0c6d)

### 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

![GameManager has StateManager Component](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0-KLgOacVpbicrqehO-887967055%2Fuploads%2FtCB2POi1y3WFrpaslz1M%2FScreen%20Shot%202022-03-03%20at%207.44.26%20AM.png?alt=media\&token=a5ef5b05-3f19-4875-8149-f231e798c53d) ![In Play-mode](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0-KLgOacVpbicrqehO-887967055%2Fuploads%2FPBPri3aP4DTjAhb8Gt4N%2FScreen%20Shot%202022-03-03%20at%207.44.14%20AM.png?alt=media\&token=eef8415d-e565-4b88-93ba-16c67352912e)

### **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

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-MHwJCGGZwkOwDKI-Hq9%2F-MHwNM0Wy8Fc1BcGIYQw%2FScreen%20Shot%202020-09-23%20at%202.11.34%20PM.png?alt=media\&token=b46fba27-fdca-4d59-a735-34996e9a54f4)

#### 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.
