Journal 85 — Unity 2.5D Platformer, Add Collectibles

Chris Nielsen
2 min readSep 6, 2021

--

Objective: Add a new collectible item to basic platform with UI

In this article, I’m going to go over how I added in a collectible game object with updates to the UI to show the number collected on screen.

I first started with a 3D sphere and reduced the x-axis scale, and I added a material to give it some color and shine. I also added a collider with trigger and a RigidBody.

Then I added a coin C# script to do two things: rotate the coin and use OnTriggerEnter to add to a player score and destroy the coin object.

In the Player script, I added in an integer to track the number of coins. I also added a reference to a new UI Manager that will show the number of coins on screen and update the count.

Finally you can see the coin collectible in action.

Thank you for your time!

--

--

Chris Nielsen
Chris Nielsen

Written by Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

No responses yet