InventoryFramework.UnrealAdapter
1.0.8
dotnet add package InventoryFramework.UnrealAdapter --version 1.0.8
NuGet\Install-Package InventoryFramework.UnrealAdapter -Version 1.0.8
<PackageReference Include="InventoryFramework.UnrealAdapter" Version="1.0.8" />
<PackageVersion Include="InventoryFramework.UnrealAdapter" Version="1.0.8" />
<PackageReference Include="InventoryFramework.UnrealAdapter" />
paket add InventoryFramework.UnrealAdapter --version 1.0.8
#r "nuget: InventoryFramework.UnrealAdapter, 1.0.8"
#:package InventoryFramework.UnrealAdapter@1.0.8
#addin nuget:?package=InventoryFramework.UnrealAdapter&version=1.0.8
#tool nuget:?package=InventoryFramework.UnrealAdapter&version=1.0.8
InventoryFramework.UnrealAdapter
Unreal Engine integration for InventoryFramework: a server-authoritative inventory and crafting backend. Uses C# scripting (via Unreal's .NET support or IL2CPP pipeline).
Requirements
- Unreal Engine 5 with C# scripting support
- A running InventoryFramework server
Installation
dotnet add package InventoryFramework.UnrealAdapter
Setup
using InventoryFramework.UnrealAdapter.Models;
using InventoryFramework.UnrealAdapter.Services;
var facade = new UnrealInventoryFacade(new UnrealInventoryConfiguration
{
ServerAddress = "https://your-server:7289",
ActorId = "player-001",
ApiKey = "sk-game-your-key"
});
var result = await facade.ConnectAsync();
if (!result.Succeeded)
{
// handle connection error
return;
}
await facade.CreateDefaultInventoryAsync();
await facade.RefreshAsync();
Reading inventory state
var snapshot = facade.CurrentSnapshot; // last fetched, no network call
// or: var snapshot = await facade.RefreshAsync();
foreach (var container in snapshot.Containers)
{
foreach (var slot in container.Slots.Where(s => !s.IsEmpty))
{
Console.WriteLine($"{slot.ItemDefinitionId} x{slot.Quantity}");
if (slot.HasDurability)
Console.WriteLine($" Durability: {slot.CurrentDurability}/{slot.MaxDurability}");
foreach (var affix in slot.Affixes)
Console.WriteLine($" {affix.AffixDefinitionId}: {affix.Value}");
}
}
Item operations
// Transfer a slot between containers
await facade.TransferItemsAsync(sourceContainerId, slotIndex: 2, targetContainerId, quantity: 1);
// One-button quick-store (backpack to chest, skips locked slots)
await facade.QuickStoreToTargetContainerAsync(sourceContainerId, targetContainerId);
// Lock a slot; protected from quick-store and auto-sort. Manual moves still work.
await facade.LockSlotAsync(containerId, slotIndex: 2, lockSlot: true);
// Split a stack into two slots
var split = await facade.SplitStackAsync(containerId, sourceSlotIndex: 0, amount: 5);
Console.WriteLine($"Split landed in slot {split.DestinationSlotIndex}");
// Drop items; returns item id and quantity to spawn a world pickup
var drop = await facade.DropItemsAsync(containerId, slotIndex: 0, amount: 3);
if (drop.Succeeded) SpawnWorldPickup(drop.DroppedItemDefinitionId, drop.DroppedQuantity);
// Sort all unlocked slots
// sortMode: 0 = ByNameAscending, 1 = ByWeightDescending, 2 = ByTagThenName
await facade.SortContainerAsync(containerId, sortMode: 0);
Item affixes (per-instance modifiers)
Affixes are rolled modifiers on individual item stacks: fire damage, crit chance, move speed, etc. Define them in Data/Affixes/affixes.json on the server:
// Grant a sword with specific affix values (admin)
await facade.GrantItemsAsync(containerId, "sword", quantity: 1, affixes: new[]
{
new ItemAffixRequest { AffixDefinitionId = "fire_damage", Value = 38.5f },
new ItemAffixRequest { AffixDefinitionId = "crit_chance", Value = 12.0f }
});
// Affixes are included in every snapshot
var snapshot = await facade.RefreshAsync();
foreach (var container in snapshot.Containers)
foreach (var slot in container.Slots.Where(s => !s.IsEmpty))
foreach (var affix in slot.Affixes)
Console.WriteLine($"{slot.ItemDefinitionId} | {affix.AffixDefinitionId}: {affix.Value}");
Crafting
// Preview before committing
var preview = await facade.PreviewCraftItemsAsync(
"sword_recipe", sourceContainerId, targetContainerId,
count: 1, station: "forge");
Console.WriteLine($"Can craft: {preview.CanCraftRequestedCount} Max: {preview.MaxCraftableCount}");
if (preview.CanCraftRequestedCount)
await facade.CraftItemsAsync(
"sword_recipe", sourceContainerId, targetContainerId,
count: 1, allowPartial: false, station: "forge");
// List available recipes for current inventory
var available = await facade.GetAvailableRecipesAsync(sourceContainerId);
foreach (var recipe in available.Recipes)
Console.WriteLine($"{recipe.DisplayName} ({recipe.CraftingCategory})");
Player progression
await facade.UnlockRecipeKeyAsync("tier2_weapons");
var progression = await facade.GetPlayerProgressionAsync();
foreach (var key in progression.UnlockedKeys)
Console.WriteLine($"Unlocked: {key}");
Session controller
For screens that need live state and connection tracking:
var controller = new UnrealInventorySessionController(facade);
await controller.StartSessionAsync();
// controller.State.Snapshot = current inventory
// controller.State.IsConnected = connection status
// controller.State.ErrorMessage = last error if any
Error handling
Every operation returns a result with Succeeded and ErrorMessage:
var result = await facade.TransferItemsAsync(sourceId, slotIndex: 0, targetId, quantity: 5);
if (!result.Succeeded)
Console.WriteLine($"Transfer failed: {result.ErrorMessage}");
Full documentation: Unreal Integration Guide
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- InventoryFramework.SDK (>= 1.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.