Showing posts from September, 2020

Unity Quick Tip - Placing Objects on the Ground

More often than not, when we're placing objects in our scene we want to place them on the ground. This can be tricky to get exactly right when positioning manually, so in this quick tip we'll look at a feature of Unity that does this for us automatically. To demonstrate this, we'll create a new 3D Project. We'll add a Plane to the scene by clicking the plus button on the Hierarchy panel and selecting 3D Object->Plane. Next we'll add a cube to the scene by clicking the plus button on the Hierarchy panel and selecting 3D Object->Cube. When the cube is added to the Scene it is buried in the plane rather than sitting on top of it.  We could try to drag it up so that it is sitting on top, but this is hard to get right with the naked eye. Instead, we'll hold down Ctrl and Shift, or Command and Shift on a Mac. We can now drag the cube around and it will automatically snap to the surface of the plane and we can position it where we want. If we now add another cube

Implementing a Double Jump - Unity Game Development Tutorial

In this Unity game development tutorial we'll be looking at how to make a game character do a double jump. We're going to start with the project we created in our 'Controlling a Character' Tutorial. For those of you that haven't followed this tutorial, we'll give a quick overview. We've got our character and a few obstacles for it to interact with. Attached to the character is the following script.  using UnityEngine; public class PlayerMovement : MonoBehaviour { public float speed; public float rotationAnglePerSecond; public float jumpSpeed; private CharacterController characterController; private float yVelocity;      private float stepOffset; stepOffset; void Start() { characterController = GetComponent< CharacterController >(); stepOffset = characterController.stepOffset; } void Update() { float horizontal = Input .GetAxis( "Horizontal" ); floa

Unity Quick Tip - Using the Colour Picker Outside of Unity

In this Unity quick tip we'll look at how the colour picker in Unity can be used to select colours from outside of the Unity interface. To demonstrate this, we’ll create a new 3D Project. We’ll then set the size of the Unity window so that it only fills half of the screen. Then we’ll open our browser and find an image of a meadow and position that in the other half of the screen. We’ll add a material to the project by clicking the plus button on the Project panel and selecting Material. If we then click the colour picker next to Albedo Color in the Inspector, we are able to pick a colour from anywhere on the screen, whether it be from Unity itself or from the image of the meadow. That covers everything for this tip. We hope that you found it useful. Please leave any questions or feedback in the comments below, and don't forget to subscribe to get notified when we publish our next post. Thanks.