---
title: "Creating Collectibles"
content_type: tutorial
url: "https://learn.unity.com/course/beginner-scripting-old/unit/roll-a-ball/tutorial/creating-collectibles-1?language=en"
language: en
container_type: course
container_title: "Beginner Scripting"
container_url: "https://learn.unity.com/course/beginner-scripting-old.md?language=en"
unit_title: "3D Beginner Game: Roll-a-Ball"
unit_url: "https://learn.unity.com/course/beginner-scripting-old/unit/roll-a-ball?language=en"
standalone_markdown_url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en"
previous_title: "Setting up the Play Area"
previous_url: "https://learn.unity.com/course/beginner-scripting-old/unit/roll-a-ball/tutorial/setting-up-the-play-area-1?language=en"
previous_markdown_url: "https://learn.unity.com/course/beginner-scripting-old/unit/roll-a-ball/tutorial/setting-up-the-play-area-1.md?language=en"
next_title: "Detecting Collisions with Collectibles"
next_url: "https://learn.unity.com/course/beginner-scripting-old/unit/roll-a-ball/tutorial/detecting-collisions-with-collectibles-1?language=en"
next_markdown_url: "https://learn.unity.com/course/beginner-scripting-old/unit/roll-a-ball/tutorial/detecting-collisions-with-collectibles-1.md?language=en"
difficulty: beginner
duration_minutes: 15
unity_version:
  - "6.3"
  - "6.0"
  - "6 Preview"
  - "6 Beta"
  - "2023.2"
  - "2023.1"
  - "2022.3"
supported_unity_versions:
  - name: "2020.2"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=2020.2"
  - name: "2020.1"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=2020.1"
  - name: "2019.4"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=2019.4"
  - name: "2019.3"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=2019.3"
  - name: "6.3"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=6.3"
  - name: "6.0"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=6.0"
  - name: "6 Preview"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=6+Preview"
  - name: "6 Beta"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=6+Beta"
  - name: "2023.2"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=2023.2"
  - name: "2023.1"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=2023.1"
  - name: "2022.3"
    url: "https://learn.unity.com/tutorial/creating-collectibles-1.md?language=en&version=2022.3"
last_updated: "2026-08-04T14:23:50.000Z"
---

# Creating Collectibles

Design a PickUp GameObject, script its rotation, convert it to a Prefab, and instantiate collectibles around the play area.

In this tutorial, you’ll:

- Create a PickUp GameObject for the player to collect
- Write a script to rotate the collectible
- Turn the PickUp GameObject into a Prefab
- Instantiate the Prefab around your play area

## Materials

- [Create_a_collectible_GameObject-Transcript.txt](https://unity-connect-prd.storage.googleapis.com/20230831/ba07edbf-674e-4c13-9120-12172ed7e431/Create_a_collectible_GameObject-Transcript.txt)
- [Rotate_the_PickUp_GameObject-Transcript.txt](https://unity-connect-prd.storage.googleapis.com/20200716/ff9945fd-52de-445a-a7dd-ec62ef34a9e6/Rotate_the_PickUp_GameObject-Transcript.txt)
- [Make_PickUp_a_Prefab-Transcript.txt](https://unity-connect-prd.storage.googleapis.com/20230831/fd06aaf4-865f-42ba-9a4b-6d5ed2c2aceb/Make_PickUp_a_Prefab-Transcript.txt)
- [Add_more_collectibles-Transcript.txt](https://unity-connect-prd.storage.googleapis.com/20200716/98e50128-66d3-40ff-b5cd-45bd3be38fcb/Add_more_collectibles-Transcript.txt)

## 1. Overview

In this tutorial, you’ll:

- Create a PickUp GameObject for the player to collect
- Write a script to rotate the collectible
- Turn the PickUp GameObject into a Prefab
- Instantiate the Prefab around your play area

By the end of this tutorial, your game will look something like this:

[Video](https://connect-mediagw.unity.com/h1/20230920/videos/2f0b8353-b9dc-4d32-a9a4-eccd7ff6f103_5.2.final-pickups-duplicated.mp4)

## 2. Create a collectible GameObject

Follow the video or text instructions below to create a **PickUp** GameObject, set the **PickUp** GameObject’s **Transform** values, and create a **PickUp** material:

[Video](https://connect-mediagw.unity.com/h1/20230828/videos/8b484339-32a1-4a44-b736-c22410127182_Unity_RollABall_5-1_2022_LTS_Update.mp4)

[Download Transcript ](https://connect-prd-cdn.unity.com/20230831/ba07edbf-674e-4c13-9120-12172ed7e431/Create_a_collectible_GameObject-Transcript.txt)

## 1\.  Create a PickUp GameObject.

- In the **Hierarchy** window, **right-click** > **3D Object** > **Cube,** then rename it “PickUp”.
- Reset the **PickUp** GameObject’s **Transform** component.
- Press the **F** key to frame in on the **PickUp** GameObject in the **Scene** view.
- Use the **Move tool** to drag the **PickUp** GameObject out of the way so it’s not overlapping with the **Player** GameObject.


## 2\.  Set the PickUp Gameobject’s Transform values.

- Set the **PickUp** Gameobject’s **Position Y** value to **0.5** to raise it above the **Ground** GameObject.
- Set each of the **Rotation** axis values to **45** to tilt it on an angle.
- Set each of the **Scale** axis values to **0.5** to make it smaller.


## 3\.  Create a PickUp material.

- In the **Project** window, find and select the **Background** material.
- In the main menu, go to **Edit** > **Duplicate**. Alternatively, you can press **Ctrl**+**D** (macOS: **Cmd**+**D**).
- Rename the new material “PickUp”.
- With the **Pickup** material still selected in the **Project** window, use the **Base** **Map** property swatch or dropper to change its color property.
- Set the **RGB** values **255**, **200**, and **0** for a bright yellow.
- Drag the **PickUp** material from the **Project** window onto the **PickUp** GameObject in the **Scene** view.

![](https://connect-mediagw.unity.com/h1/20230920/learn/images/c8718274-9547-45ae-b100-768eb1645070_1-set-up-pickup.png)

## 3. Rotate the PickUp GameObject

Follow the video or text instructions below to create a new **Rotator** script and rotate the **PickUp** GameObject in the **Update** function:

[Video](https://connect-mediagw.unity.com/h1/20211215/videos/e51a6ccb-cf59-4ac7-b514-d34052b98c5c_Unity_RollABall_5_2.mp4)

[Download Transcript ](https://connect-prd-cdn.unity.com/20200716/ff9945fd-52de-445a-a7dd-ec62ef34a9e6/Rotate_the_PickUp_GameObject-Transcript.txt?_ga=2.116366222.943030393.1594530423-42703541.1592249374)

## 1\.  Create a new Rotator script.

- With the **PickUp** GameObject selected in the **Hierarchy** window, select **Add Component** > **New script** in the **Inspector** window.
- Name your new script “Rotator”.
- In the **Project** window, move the script from the root **Assets** folder into the **Scripts** folder.
- Open the new script for editing.

![](https://connect-mediagw.unity.com/h1/20230920/learn/images/7bfbd23d-fede-4122-92c1-62a591367137_2-rotator-script.png)

## 2\.  Rotate the PickUp GameObject in the Update function.

- With the **Rotator** script open, remove the **Start** function — you won’t need it.
- After the opening curly brace of the **Update** function, add the following line of code:

```csharp
transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime);
```

[Video](https://connect-mediagw.unity.com/h1/20230920/videos/fc7b9cb4-45f4-4c57-b02f-9ae2b3175d29_5.2.2-pickup-rotating.mp4)

## 4. Make PickUp a Prefab

Follow the video or text instructions below to turn the **PickUp** GameObject into a prefab, then enter and exit prefab editing mode:

[Video](https://connect-mediagw.unity.com/h1/20230828/videos/33d6a588-6fd3-45cc-b966-f4e0bd412c29_Unity_RollABall_5-3_2022_LTS_Update.mp4)

[Download Transcript ](https://connect-prd-cdn.unity.com/20230831/fd06aaf4-865f-42ba-9a4b-6d5ed2c2aceb/Make_PickUp_a_Prefab-Transcript.txt)

## 1\.  Turn the PickUp GameObject into a prefab.

- In the Assets folder, **right-click** > **Create** > **Folder**, then rename this new folder “Prefabs”.
- Drag the **PickUp** GameObject from the **Hierarchy** window into the **Prefabs** folder.


## 2\.  Enter and exit prefab editing mode.

- Select the arrow to the right of the **PickUp** GameObject in the **Hierarchy** window to open prefab editing mode.
- To return to the normal **Scene** view, select the back arrow at the top of the **Hierarchy** window.


![](https://connect-mediagw.unity.com/h1/20230920/learn/images/4cb7954d-daad-499a-bbc0-641b54f573c5_3-make-pickup-prefab.png)

## 5. Add more collectibles

Follow the video or text instructions below to make an empty parent GameObject for the pickups, align to a top view of the scene, place duplicate pickups around the scene, and test your game:

[Video](https://connect-mediagw.unity.com/h1/20211215/videos/22792ea6-5f23-4221-abdc-fd687b28fd3c_Unity_RollABall_5_4.mp4)

 [Download Transcript](https://connect-prd-cdn.unity.com/20200716/98e50128-66d3-40ff-b5cd-45bd3be38fcb/Add_more_collectibles-Transcript.txt?_ga=2.19954352.943030393.1594530423-42703541.1592249374)

## 1\.  Make an empty parent GameObject for the PickUp GameObjects.

- In the **Hierarchy** window, create a new empty GameObject and name it “PickUp Parent”.
- Reset the **Transform** component.
- In the **Hierarchy** window, drag the **PickUp** GameObject onto the **PickUp Parent** GameObject.


**Important:**  Before beginning this step, set the tool handles in the Scene view to **Global** coordinates rather than **Local**. With **Global** coordinates, the Scene view tools will always point in the same directions, regardless of how the selected object is rotated. This will make it easier to move the Pickups straight along the X and Z planes.

![](https://connect-mediagw.unity.com/h1/20240919/learn/images/4ddc5509-3402-4042-9c57-e9f4cfc45352_global-coords-selected.png)

## 2\.  Align to a top view of the scene.

- Select the Gizmo in the upper right of the **Scene** view to switch to a top-down view.
- Zoom out a little so you can see the entire play area.


## 3\.  Place duplicate pickups around the scene.

- Move the first **PickUp** GameObject somewhere you like.
- With the **PickUp** GameObject selected, duplicate it with **Ctrl**+**D** (macOS: **Cmd**+**D**).
- Use the **Move** tool to relocate the second instance of the prefab.
- Repeat this process to place as many **PickUp** GameObjects as you like in the scene.


[Video](https://connect-mediagw.unity.com/h1/20230920/videos/1f15cc82-a885-49f0-9b29-2fce0a4bce62_5.4.3-duplicating-pickups_changed.mp4)

## 4\.  Test your game.

- When you test your game, you will notice that the PickUp GameObjects are still acting like solid obstacles. You’ll fix that in the next tutorial.

[Video](https://connect-mediagw.unity.com/h1/20230920/videos/b75e28f2-535a-4bbe-aaaf-280f485ab9ff_5.2.final-pickups-duplicated.mp4)

## 6. Final script sample _(Optional)_

If your script is not working as expected, below is an example of what your code should look like at this point. The comments have been added to make the code more readable.


## Rotator.cs

```csharp
using UnityEngine;

public class Rotator : MonoBehaviour
{

 // Update is called once per frame
 void Update()
    {
 // Rotate the object on X, Y, and Z axes by specified amounts, adjusted for frame rate.
        transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime);
    }
 
}
```
