Day 12
4 min readNov 25, 2020

Things That Went Wrong: #Could’veHadaV8
- Speed Boost Power Up: While trying to run my game, I noticed the power up was not functioning the way it needed to. I spent majority of the morning trying to figure out why. I went back to the coursework videos and realized; I missed the coursework video that talks about implementing the speed boost power up.
- UI (user interface): when I tried to run the ui for the point system, I ran into errors. I spent the majority of my day trying to figure out why these error messages (see below) occurred. I looked back through the course videos and consulted the team. I shared the error messages with my team and showed them my codes, to no avail. I then finally decided to delete my entire code and start over. I realized my mistake, I forgot to type in an underscore before the UIManager variable code — private UI Manager uiManager(see below for correct code). Once I rewrote the correct code, everything began to work without errors.


Once I was able to mend the speed boost power up, I moved onto the next segment of the course, creating a Score System.
Score Text UI Setup:
- Today I set up a score system for my game. First, I created a UI canvas. UI stands for user interface. To do so, I right clicked on the hierarchy, chose UI, and different UI options show up. For my purposes, I chose text. There is also the option for text text mesh pro which will provide more advanced text settings. A text object will then show up under canvas. A canvas is a white screen on the scene window that makes up the UI. All UI elements will go into the canvas and will also allow for further organization. The text canvas is movable and can be placed anywhere within the canvas. Events System is auto added on when a canvas is created. This will allow me to interact with the UI i.e. menu buttons once created. I then created the text for my score system via Unity. For my sake I used score_text. I then anchored the text under Inspector -> rect transform -> anchor presets (will look like scope crosshairs). Once anchored I am able to drag my text in place. To scale with screen size, I select canvas -> canvas scaler -> ui scale mode -> selected scale with screen size; this keeps it proportionate with screen being used. Next, I wanted to change my text. To do so click on canvas -> choose text -> text script: Text = value. Under the text (script) you are also able to change font, style, size spacing, etc…
Score Implementation:
- Once I created the text for the score system, I set up an UI manager. This is responsible for all things relevant to the on screen display. To do so, I created game object titled: uiManager. Then I created a script titled uiManager, selected it -> dragged to inspector. Next, I doubled click on the script to open visual studios. Once Visual Studios is open, I am going to create a variable. For my sake, I am going to create the score variable, an integer data, under the player. The code I used is private int_score; Before I moved on, I wanted to be able to visualize the variable, so I used the code — serializefield. To utilize the text within the UI, I used using UnityEngine.UI. Going back to Unity, under canvas -> add component -> add UiManager -> drag score txt to UI manager script; now text will be referenced in Visual Studios. For my purposes, this is how I coded my score system.
