Posts

Showing posts from November, 2020

Selecting a Target with the Mouse - Unity Game Development Tutorial

Image
In this Unity game development tutorial we're going to look at how we can select a target in the 3D world using the mouse. You can either watch the video version below or continue reading for written instructions. We're going to start with the scene we created in our ' Colliding with Obstacles ' tutorial.  We've got a ball and a stack of boxes that all have a Rigidbody component attached so that they react to forces and collisions. We're going to add the ability to select a target with the mouse and then fire the ball at the selected target when the left mouse button is clicked. The first thing we're going to do is make the cardboard box change colour when the mouse cursor is over it, so the player knows which box they are targeting. To do this, we'll go to the Project panel and navigate to Assets->CrowArt PBR Cardboard Box->Prefabs, and we'll select the 'CarboardBox_1' box prefab.  We'll add a script to the prefab by clickin

Changing the Colour of a Material - Unity Game Development Tutorial

Image
In this Unity game development tutorial we're going to look at how we can write a script to change the Albedo colour of a material. We’ll cover how to change the colour of all objects with the same material and how to change individual instances. You can either watch the video version below or continue reading for written instructions. Right, let's get started by creating a new 3D project in Unity Hub. We'll add a cube to the scene by clicking the plus button in the hierarchy and selecting 3D Object->Cube. Next, we'll create a material. To do this we’ll click on the plus button on the Project panel and select Material. We’ll name this material 'Cube'. We'll click on this box next to Albedo, and choose a green colour.  We can now drag the material onto the Cube to assign it. Next, we'll add a script to change the colour when the mouse is over the cube. To do this we’ll select the cube in the hierarchy, click on 'Add Component' and search

Infinite Bounce - Unity Game Development Tutorial

Image
In this Unity game development tutorial we're going to look at how we can make use of physics materials to make objects bounce in Unity indefinitely. You can either watch the video version below or continue reading for written instructions. Right, let's get started by creating a new 3D project in Unity Hub. We'll add a cube to the scene by clicking the plus button in the hierarchy and selecting 3D Object->Cube. We'll set the Transform for the cube as follows. Next, we'll create a material to change the colour of the cube. To do this we’ll click on the plus button on the Project panel and select Material. We’ll name this material 'Green'. We'll then click on the box next to Albedo in the Inspector panel, and choose a green colour.  We can now drag the material onto the Cube to assign it. We're now going to get a ball from the asset store by selecting Window->Asset Store from the main menu. We'll then search for 'Low Polygon Socc