How to Create a Collectable in Unity

Objective: download an asset and create a collectable for your game.

For this example I downloaded a 3d battery model for my game and added it to the scene.

With the model in the scene we have to add a collider component to detect the player, in this case the capsule collider is ideal for this asset.

Then We have to create a collectable script and attach it to the collectable. In the script we have to use the function on trigger enter to check the player tag and Update the UI counter and destroy the collectable given the illusion that the player collected it.

And that’s it!!! We have a new collectable for our Unity game.

--

--

--

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

From Chef to Software Engineer

MS Excel — Simplify Your Excel Workbooks With A Navigation Index

What you need to know about Android app memory leaks

Traceback Writeup — HackTheBox

Are You Confused with Encapsulation? Clear It now.

CS373 Spring 2022: Tanner Dreiling, Week 11

Building a Web-Based Motion Graphics Editor

Two Ways to Quickly Integrate New Members to a Stablished Dev Team

Photo by @brookecagle on Unsplash

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

How to Create the Hand-Held Camera Look on Unity Cameras using Noise

Creating a Roll Player Action in Unity

Creating a Smart Enemy in Unity

Mastering Unity Scripting | Summary — Chapter 3: Singletons, Statics, GameObjects, and the World