InventoryFramework.UnityAdapter
1.0.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package InventoryFramework.UnityAdapter --version 1.0.3
NuGet\Install-Package InventoryFramework.UnityAdapter -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InventoryFramework.UnityAdapter" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="InventoryFramework.UnityAdapter" Version="1.0.3" />
<PackageReference Include="InventoryFramework.UnityAdapter" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add InventoryFramework.UnityAdapter --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: InventoryFramework.UnityAdapter, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package InventoryFramework.UnityAdapter@1.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=InventoryFramework.UnityAdapter&version=1.0.3
#tool nuget:?package=InventoryFramework.UnityAdapter&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
InventoryFramework.UnityAdapter
Unity integration for InventoryFramework — a server-authoritative inventory and crafting backend. Wraps the gRPC SDK in a MonoBehaviour-friendly facade so you spend zero time on transport code.
Requirements
- Unity 2021.3 LTS or later
- .NET Standard 2.1 scripting backend
- A running InventoryFramework server
Installation
dotnet add package InventoryFramework.UnityAdapter
Or copy the DLLs from dist/unity/ into Assets/Plugins/.
Setup
using InventoryFramework.UnityAdapter.Models;
using InventoryFramework.UnityAdapter.Services;
public class InventoryManager : MonoBehaviour
{
private UnityInventoryFacade _facade;
private async void Start()
{
_facade = new UnityInventoryFacade(new UnityInventoryConfiguration
{
ServerAddress = "https://your-server:7289",
ActorId = SystemInfo.deviceUniqueIdentifier,
ApiKey = "sk-game-your-key"
});
await _facade.CreateDefaultInventoryAsync();
await _facade.RefreshAsync();
}
private void OnDestroy() => _facade?.Dispose();
}
Common operations
// Grant items (admin)
await _facade.GrantItemsAsync(containerId, "wood", 10);
// One-button quick-store (backpack → chest)
await _facade.QuickStoreToTargetContainerAsync(sourceId, targetId);
// Craft with station check
var preview = await _facade.PreviewCraftItemsAsync("plank_recipe", sourceId, targetId, count: 3, station: "workbench");
if (preview.CanCraftRequestedCount)
await _facade.CraftItemsAsync("plank_recipe", sourceId, targetId, count: 3, allowPartial: false, station: "workbench");
// Transfer a slot
await _facade.TransferItemsAsync(sourceId, slotIndex: 0, targetId, quantity: 5);
// Lock a slot (skipped by quick-store and sort)
await _facade.LockSlotAsync(containerId, slotIndex: 2, lockSlot: true);
// Split a stack into two slots
var split = await _facade.SplitStackAsync(containerId, sourceSlotIndex: 0, amount: 5);
Debug.Log($"Split landed in slot {split.DestinationSlotIndex}");
// Drop items (optionally spawn a world pickup)
var drop = await _facade.DropItemsAsync(containerId, slotIndex: 0, amount: 3);
if (drop.Succeeded) SpawnWorldPickup(drop.DroppedItemDefinitionId, drop.DroppedQuantity);
// Sort container (0 = ByNameAscending, 1 = ByWeightDescending, 2 = ByTagThenName)
await _facade.SortContainerAsync(containerId, sortMode: 0);
// Read current inventory state
var snapshot = _facade.CurrentSnapshot;
foreach (var slot in snapshot.Containers[0].Slots.Where(s => !s.IsEmpty))
Debug.Log($"{slot.ItemDefinitionId} x{slot.Quantity} — durability: {slot.CurrentDurability}");
Session controller
For longer sessions with UI data binding:
var controller = new UnityInventorySessionController(_facade);
await controller.StartSessionAsync();
// controller.State.Snapshot — current inventory
// controller.State.IsConnected
Full documentation: Unity 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- InventoryFramework.SDK (>= 1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.