Platformer PRO provides support for various kind of collectible items.

To get started with Items:

  1. Add an ItemManager to your Character GameObject (see ItemManager below).
  2. Make sure your character has a correctly set up HurtBox or other CharacterReference.
  3. Add a GameObject to represent your item. Make sure this is in a non-geometry layer that can interact with Characters (e.g. the 'Collectible_Projectile' layer that is setup by default).
  4. Add the Item component to your Item GameObject.
  5. Add a 2D collider to your Item GameObject.
  6. Create a GameObject that is a child of your Item GameObject
  7. Add a visible component (such as a SpriteRenderer) to this child GameObject.

Note: Its not vital that the visible component be a child but this is good practice as it allows you to effect the visible component of the item without affecting its behaviour.

Item Classes

There are four types of items:

STACKABLE An item that can be stacked up in the inventory until some maximum is reached. For example coins or stars.
SINGLE An item of which the player can only have one.
KEY Special item type used to unlock doors. See Doors for more information.
POWER_UP  Special item type which grants the user new powers. See Power Ups. 


Item Type

The item type is a string identifier for the type of item. It can be anything you want, but remember items with the same ID should, for all intents and purposes, be the same.

Create a Stack of Items

If you wish to add more items to a stack (e.g. 10 bullets instead of 1), update the Item component to instead be a StackableItem. And enter an amount in the Amount field.

Item Manager

The ItemManager component handles collecting and using items. It must be added to your Character GameObject or to a child of your Character GameObject.

Configuring Stacks of Items

The ItemManager allows you to configure stackable items by adding one or more items with the following details:

Type   Unique ID for the item type (e.g 'fuel' or 'COIN').
Max Maximum number of items allowed (i.e. how many can the Character hold).
Starting Count Allow your character to start with some of this item. For example you may want to start with 20 bullets or 100 fuel.


Configuring Persistence

The ItemManager is a Persistable (see Persistables) and thus allows you to persist the state of the items between levels, games or even play sessions.

Typically you want to load Item data when the level starts or the Character loads and save it when the level ends or the character dies. When the character loses all their lives (GameOver) you would usually reset the data.


Warning: Be mindful of the effects of saving data. For example if your level reloads on death and your ItemManager does not reset on death the character will be able to collect the same objects multiple times. This is fine for some games, but not for others.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk