Posted on

How to Use UI Buttons for Basic Input in Unity

Sometimes in Unity, you want to read in a basic input from the players. This could be a left mouse click or a touch of a mobile screen anywhere in your game. This is a common thing to do especially for simple mobile games like ZigZag. There is a very simple what to read in player input the is different than the standard way and comes will some extra benefits. What I am talking about is using a full-screen transparent UI button in Unity.

This is nice because you don’t have to use the Update function, You can have other UI elements on top of the button, and it works on both computer and mobile platforms. Sometimes in Unity, you want to read in a basic input from the players. This could be a left mouse click or a touch of a mobile screen anywhere in your game. This is a common thing to do especially for simple mobile games like ZigZag. There is a very simple what to read in player input the is different than the standard way and comes will some extra benefits. What I am talking about is using a full-screen transparent UI button in Unity.

This is nice because you don’t have to use the Update function, You can have other UI elements on top of the button, and it works on both computer and mobile platforms.

Posted on

What is a Kinematic Rigidbody in Unity

For this short Unity Lesson, I teach you what the is Kinematic option does on the Rigidbody component in Unity. The is kinematic setting makes it so that the rigidbody object will not move because of Physics.

Now you might be wondering, why would you want to attach a rigidbody component to an object only to disable to physics of the object? The answer is that sometimes you want an object to be stationary until a certain point and only after something happens do you want the object to interact with physics. At that point, all you have to do is disable the is kinematic option.

For example in my Zig Zag tutorial series I want the platforms to eventually fall but not until that ball touches the platform and then leaves the platform. This will then make it look like all the platforms are falling just behind the ball.

Posted on

How to Scale an Object in One Direction Unity

For this very quick lesson, I should you how to scale an object in only one direction in Unity. When you scale an object is scales based on the pivot of the object. Most of the time the pivot is in the center which means the object will scale in both directions.

To scale an object in only one direction to need to give the object a new pivot point to scale from. You can do this by using a parent-child relationship with an empty game object. If you make the object you want to scale a child to the empty then place the parent/empty object in the position you want the pivot to be. To scale the object in one direction then place the parent object on the edge or face on the child object.

You can then scale the parent object with will scale the child object in one direction.