Skip to main content

Getting Started

  1. First of all, make sure you have Unity UI Canvas in your scene. Navigate to Project Settings/SoftKitty/Data Settings and setup the following databse:

  1. Add EntityComponent component to of your player game object. This component is an interface of the Entity data, which manages Attributes, Items, OverTimeEffects and other CustomData of your characters/crates.

  1. (Optional) Drag the ActionBar prefab from the Assets/SoftKitty/InventoryEngine/Prefabs folder and place it under your UI Canvas transform. This prefab provides 10 shortcut slots with customizable key bindings for items/skills on each page, and you can set up as many pages as needed for players to switch between. The action bar also includes a progress bar at the bottom, which can be configured as a player XP bar to display experience and level, or as a player health bar. Alternatively, you can hide this bar using its UiStyle component.

  1. You can now start testing some basic functions. In your own script, use the following calls:
//to open the player's inventory.
GameManager.GetPlayer().GetInventory().OpenWindow()`;
//to open the player's equipment UI.
GameManager.GetPlayer().GetEquipment().OpenWindow()`;
//to open the crafting/enhancing/enchanting/socketing UI.
GameManager.GetPlayer().GetInventory().OpenForgeWindow(true, true, true, true, 1F,"Forge");
//to open the skill list.
GameManager.GetPlayer().GetInventory().OpenWindowByName("Skills", "Skills")`;

  1. Now, let's add some more interesting functions. Add an Entity in EntityManagerObject from the Project Settings/SoftKitty/Entity Manager, input its uid as MerchantNPC, add a new 'Inventory' to it and select the Type as Merchant:

  1. Let's add a few items to him, and setup the Price Multiplier, make sure Accept all tradeable items is checked. Don't forget add some currencies to him, otherwise he would not be able to purchase player's goods.

  1. Now in your script, whenever you want to open the store, simply call:
GameManager.GetEntity("MerchantNPC").GetInventory().OpenWindow();

Alternatively, you can add a EntityComponent to one of your NPC character, select its UID as MerchantNPC. When your player interact with it, call:

  myNPC.GetComponent<EntityComponent>().GetInventory().OpenWindow();

  1. You can create Entity in database for any object in your game. When the player interacts with it, call OpenWindow() to open the corresponding interface. The specific interface that appears depends on the Type setting of the InventoryData. In steps 4 and 5, we tested most types of InventoryData. Now, let's test the last one. Create an Entity and set its Inventory type as Crate. When the player interacts with it, call OpenWindow() to display the crate UI.

  1. If your game includes loot packs that players can obtain from defeating monsters or completing quests, you can use the LootPack prefab found in the Assets/SoftKitty/InventoryEngine/Prefabs/Entity/ folder. When the loot pack drops, instantiate this prefab at the desired position. When the player interacts with the loot pack, call GetComponent<LootPack>().OpenPack() to open the interface and allow the player to collect their rewards.

  1. Check MainMenu.cs in Assets/SoftKitty/InventoryEngine/ExampleScene/Scripts to learn how to setup Callbacks for player uses, equips, or unequips an item. You can also learn how to save/load data, assign crafting tasks to NPCs, and manage NPC equipment and inventory.

  1. Now that we've walked through all the pre-made interfaces, you can easily create your own by customizing the existing prefabs in the Assets/SoftKitty/InventoryEngine/Resources/InventoryEngine/UiWindows folder. Adjust the settings in the UiStyle component on each prefab to suit your needs. Alternatively, you can write your own script by inheriting from ItemContainer.cs, ContainerBase.cs, or HiddenContainer.cs.