Vending Machines

The page outlines a detailed guide on setting up a vending machine in a WB project.


In order to sell items from vending machines, you will need a currency to transact in. If you do not already have a currency created for your project, see Account Balances.

Purchasable Items

You will need create purchasable items to add to your vending machine. Follow the Public Purchasable Guide to create purchasable items/

Configuring your Vending Machines

Before you can create and place vending machine actors in your project, you will need to tell the game what purchasable items exist. In order to do this, we first need to create a data table that uses the FBasePurchaseableTableRow structure. This links a UM2_PurchaseablePrimaryAsset asset with a currency and price. Below shows an example data table:

Once your data table is setup, you will need to create a โ€œvending machine managerโ€œ (VMM). To do this create a morpheus actor asset deriving from BPM_VendingMachineManager. Inside the VMM asset you just created, override the value of โ€œDeviceVendingMachineTableโ€, linking to the data table you created previously.

Next go to your world settings and find the โ€œAdditional Singletonsโ€œ property. Add your VMM class to this array.

When run, your game should now know what items can be shown in vending machines.

Creating a new Vending Machine

We recommend creating a new custom vending machine actor asset for you project. This should be done by inheriting from BP_VendingMachine. This base class utilizes the M2 interaction system and the M2 interaction system menu. If this is not right for your project, get in touch with our gameplay support team to work out what solution is best for you.

You can use the PurchasableIds property on your newly created vending machine asset to configure exactly what purchasable items are available. Simply add the corresponding row name from the vending machine purchasable data table you created for purchasable items you wish to be available in your vending machine.

Add the vending machine to your world and you should be good to go!

Last updated