###### tags: `Unity` | August 4, 2019 # Phase 2 ## 01. Console With Debug.log() 1. Debug.Log() works mostly the same as Print() 2. Print is totally valid, but Debug.Log is a bit more flexable in control. ###### eg: ``` Debug.Log("Hello, World."); ``` ## 02. Variables ### Int / Float int : integer | float : decimal > float add f in the end ###### eg: ``` int hitPoi = 18; float speed = 3.8f; ``` ### String string : data valaue ###### eg: ``` string name = "Steve"; ``` ### Bool bool : true/false ###### eg: ``` bool isAlive = true; ``` ### Join Multiple Variables * use + after the contents ###### eg ``` string name = "input"; print("Hello, World" + name); ``` ###### August 14, 2019 ## 03. if, else if, else **if** > if (A is TRUE) > > { //execute this code block only } **else if (if A is false) (otherwise)** > else if (B is true) > > { //execute this code block only } **else** > else (A and B are false) > > { //execute this code block only } ###### eg: ``` if (in the mood for openWorld) { //play Elder Scrolls } else if (in the mood for FPS) { //play OverWatch } else { //go to bed } ``` ## 04. Function 1. Function is like a contract / recipe ### void ![](https://i.imgur.com/GXnIQfb.png) ###### eg: ``` void startGame() { //Statements } ``` ### Return value Function ###### eg: ``` string GetGameText() { return storyText; } ``` * string => ### Private, Public 1. the Functions are using private in default. 2. ###### eg: ``` ```