Let’s dive into using Shader Graph for HDRP/URP. As mentioned, you need both so be sure to install either URP or HDRP as your pipeline for Unity. If you haven’t installed a pipeline yet and install URP, you may get shader graph already installed into your project.

To start using shader graph, go into project, create, shader. Be sure to choose the shaders on the bottom. The top ones are code based shaders. For now, choose PBR.

Objective: When your player dies, respawn without restarting the level.

The trick to this is you don’t destroy your player. Too many things break when that happens. What we want to do is disable the player and then re-enable it. First, we remove the destroy option. We then want to try to turn everything off. We added a _youDied bool that is applied to our update method so you can’t shoot or move when dead.

Objective — create an image that changes in size based on your health.

First thing would be to grab an image that we will use for our sprite. In your sprite, make sure you set the image type to filled and horizontal. Now we have a bar that fills from left to right. You can adjust the fill origin as necessary.

The sprite-based explosion is so hum-hum. Filebase has so many better explosions that are available. Let’s use one of those!

For starters, let’s look at my explosion prefab. It consists of 2 different particle systems, the actual explosion and a particle that bursts.

Objective: Let’s make the enemy show some sort of hit detection when smacked.

It’s generally not enough to hit an enemy and not see any sort of feedback. Let’s add a simple way to see the damage an enemy takes during runtime. To start, let’s change the emission channel from a map to a flat color.

Objective: create a color changing cube using switch statements

I must admit, I do like comparison values for numbers but I can see how this can be functional, especially with strings.

If you have more than 2 if else statements, use a switch statement since it’s cleaner to read.

This if statement above means exactly the same as the statement below.

Objective: let’s go from if statements to switch statements

A little more reorganization, but it’s a lot cleaner to read and understand. The first being that we will move the player declaration above since it will be used in all of the switch statement cases. Cases = ints, starting at 0.

Objective: Pass in a custom score value per game object to another object via a function.

Here’s how I made my score system work. What I care about is running my score direct 1–1, so when my enemy dies, I want it to talk to my UI Manager. To start, I have my Enemy connect to the UI Manager.

Objective: Create a speed boost system that doubles the speed of your ship for 5 seconds.

It’s pretty much a replication of the weapons powerup/triple shot system. I purposely separated the weapons from the powerups so this system can now take in the shield system as well.

Al Heck

Unity Developer and Software Engineer who loves making games with GameDevHQ

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