LootItems.cs

v4.0

LootItems are simple Scriptable Objects which group ItemObject objects together in preparation for use with LootBoxes. The aim is to make it eaiser to allow randomized ItemObjects to appear in LootBoxes with a fair amount of control. You may wish to create LootItems called something like:

  • Level 1 Items

  • PotionComponents

  • Legendary Rewards Lvl 50+

  • Goblin Drops

Once created, LootItems can be utilized in LootBoxes by themselves or with other LootItems to add even more variety.

Setup

Decide where you'd like to store your LootItem object, and right-click inside to select the menu option:

/Create/Game Modules/Create/Loot Item

This will create a LootItem Scriptable Object in your project. Select that and view the Inspector to begin setting up your data.

There is an optional "internal description" text area. This is included so you can describe the goals of the LootItem object. It will be visible later when you populate your LootBox objects.

All of your ItemObjects will be displayed in the yellow drop downs, with the objectTypes on the left. Click "Add" to add a single ItemObject, or "Add All" to add all of the selected type. You can remove individual ItemObjects after, if you'd like.

Once you have added all the ItemObjects, you're done!

If you set up LootBox objects using this LootItems object with "random" selected, anything you add to this LootItems object will automatically be included in the potential ItemObjects when those LootBoxes are spawned in your game.

This way you can always add new items without having to go back to add them to all the various LootBoxes they may show up in.

Feel free to look at LootItems.cs, but the script is not meant to be used outside of the flow outlined above. Of course if you think of clever ways to use it, that's great!

Last updated