This is going to be everything that I am learning and experimenting with as I have never ‘coded’ or even used uinty before. I am self teaching with various vidoes online which I will link as I go on.
Unity uses C# which is one of the most popular coding languages in the world due to its heavy use in Windows products.

Unity has 4 panels by default:
- project contains all the ‘game’ items.
- sounds
- models
- code
- textures
- Hierarchy lists all the GameObjects in the current level
- Inspector allows us to interact with the GameObjects and the scene is what will be seen by the player and how we view everything.
Every rigid body object will need to also have colliders if they want to interact with the GameObjects.

Start runs at the very start of the script and only runs once
Update will run every single frame until the script is ended

gameobject refers to the game object that the script is attatched toand anything after the ‘.’ specifies to the code what about the game object is being selected to be coded. ‘.name’ refers to the name of the object which can be changed to ‘Bob Birdington’.
‘;’ semi-colons end a line of code.
scirpts have to be saved before re-entering unity
To simplify it is like choosing someone to talk to, something to talk about, and a command.

The script is extremly perdantic and doesn’t actually know who is in the room with it. By telling it that there is a rigid body in the room, it can now interact with it and also give it all the properties in unity.

1 = is to make ie; if x is 3 typing in the code x=2 will make it 2
2== checks the x value; x== 2 is incorrect so it returns as false

As said previously update runs every frame. If/Else statements contain these inputs to make sure they dont run all the time. in this instance, If the key that has been pressed down is the space bar, the rigid body will move up. This will happen every time the space bar is pressed.
Public variables allow unity code to be edited in the unity inspector as opposed to opening and closing the code to change variables

Parent and child objects just act like leashes. The parent controls all of its children and makes it so objects can be moved around easily as a group. However, we can still edit the child objects individually from the parent.
int : represents an positive or negative integer number; float : represents a “floating point number”, i.e., a non-integer number; str : represents some alphanumeric text, know as a “string”; bool : represents a boolean value, i.e., “True” or “False”.
Leave a Reply