Then we call the GetInputs() method inside Update().ĭone. Sounds complicated, but it’s quite simple. In this method, we set xInput to have the value of the player’s horizontal axis input. We need it to move the character left and right accordingly.Ĭreate a float variable and name it “ xInput“.Ĭreate a new void method and name it “ GetInputs()“. Once we understand this, we are ready to start coding proper.įirst, we need to store the player’s horizontal input into a variable. This is useful for our camera, to reduce jitter. LateUpdate() is called every frame, but only after Update() is done for the frame. This should be used for dealing with physics. Update() is continuously called every frame.įixedUpdate() relates to the physics, and is called on a set time, independent of the frames per second. Start() is called only once, when the program starts.
We use the term FPS, frames per second, as an important metric for performance. A frame rate is how many frames there are in a second, and that generally makes the experience look more fluid. Read the link below.Ī frame is a picture drawn, rendered, to the screen. This is less ominous than it sounds like. You should see “Assembly-CSharp” in the top left corner.īefore we start coding, we should know a few things about Unity’s execution order.
(This will also name the class inside the script.) We start by going into the Project tab and the Scripts folder.Ĭreate a new C# script and name it “ Player“. Buckle up, this part will have some new information. Soon we will have our first features ready. We now have a level, a game object to use as a player, and the physics to support movement. In this part of the series we will actually program something real.