Spaceship Game Made with Unity: Adding Powerup SFX

Objective: Play a sound effect when the player collects a powerup

Now It is time for the powerups. First I created an empty game object called PowerupAudio as a child of the Audio Manager, unchecked the “Play On Awake” attribute and assigned the clip.

Then in the player script I created an AudioSource variable and assigned the reference in the Inspector. Next I created a public function to play the sound.

In the powerup script I called the PlayPowerupAudio from the player game object when we check the collision with the player.

And that’s it! SFX for powerup collection.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

[Docker Container] Failed to install apt package inside container?

FATF + DAPP = VASP

Relationships with SQLAlchemy

Right Biased Either in Scala

56 Essential Microsoft Excel Tips — Right Here!

The Most Important Thing about a Software is not that it Works

What do you know about ESP32?

Top Mobile App Development Companies in 2022

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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Unity — new input system create an action map

Quick tip — Enabling post-processing in Unity Universal Render Pipeline

Getting Started with Unity

Setting up a platformer project in Unity