My Unity Diary (2)

Sine
1 min readJun 4, 2021

Week 2

I am a learner and there can be a misunderstanding. If you spot any place of improvement, please kindly comment.

  1. C# syntax — GetKey vs. GetKeyDown

GetKey returns True as long as you press the key. so with the next update, the game reacts accordingly.

GetKeyDown only returns True once at the moment you press the key down. so with the next update, the game script receives False even though Key has been pressing down.

2. Understanding Physics- Instead of assigning x,y-coordinate at all time, writing a script which can take current reference of the game character and utilise physics. For instance, a player would push or provide force to a game character then it will be moved by the invisible force (a.k.a script), given the necessary variables such as jumpHeight or moveSpeed.

3. When variables are set public, the accessibility of the variables widen.

4. If“is Trigger” in a component is ticked and a game character collides with other colliders, it will be notified in the script.

5. Utilise Tag function

6. Importance of the simple code

7. Instead of an immediate temporary solution, train to think further.

--

--