Working with Raycast

Challenge: How to instantiate objects using Raycasting

Pre-scripting setup:

First we are going to need a new setup for this challenge. We will need a cube that will be turn into a platform and some extras (in my case) a few cylinders to so some elevation.

The glossy red will now be a new material for the sphere

Scripting:

Repeating what we have done previously, we are going to setup our script to use the New Input System (so we need to access the Input Library). Since we need to instantiate the sphere prefab we will need access to the game object, therefore we can use a serialized field to drop in the slot.

--

--

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.