Complete Data-Driven Survival System for Unreal Engine 5
Get your survival game running in under 5 minutes! This guide walks you through the essential setup.
Open your project in Unreal Engine, then:
Open your Character Blueprint and add these components from the Components panel:
In your Blueprint, click Add Component, then search for "Survival". You'll see all available components listed.
The plugin uses DataTables to define items. Here's how to create one:
Open your new DataTable and create some basic items:
Link your DataTable to the component:
In your Character's Event Graph, add this test logic:
Press Play and test! Your character now has an inventory system. Continue reading to set up needs, crafting, and building.
This section covers the complete setup process in detail, including all components and DataTables.
The plugin provides five main components that work together:
Complete inventory system with slots, hotbar, weight management, item usage, and equipment. Requires Items DataTable.
Manages survival needs: health, hunger, thirst, stamina, temperature, and custom needs. Requires Needs DataTable.
Recipe-based crafting system with crafting stations, progress tracking, and recipe unlocking. Requires Recipes DataTable.
Building placement and demolition system with snapping, preview, and validation. Requires Building DataTable.
Add to chests, crates, etc. Provides external storage that players can access. Uses same slot system as inventory.
Create these DataTables for full functionality:
| DataTable Name | Row Structure | Purpose | Assign To |
|---|---|---|---|
DT_Items |
SurvivalItemData | Define all items (resources, tools, food, etc.) | Inventory Component, Crafting Component |
DT_Needs |
SurvivalNeedData | Define survival needs (hunger, thirst, etc.) | Needs Component |
DT_Recipes |
SurvivalCraftingRecipe | Define crafting recipes | Crafting Component |
DT_Buildings |
SurvivalBuildingData | Define building pieces | Building Component |
Some components need references to others:
The inventory system manages items, stacking, weight, hotbar, and item usage.
Each item in your Items DataTable has these properties:
| Property | Type | Description |
|---|---|---|
| Item ID | Name | Unique identifier (e.g., "Wood", "IronOre") |
| Display Name | Text | Name shown to player |
| Description | Text | Item description for tooltips |
| Category | Enum | None, Resource, Tool, Weapon, Food, Drink, Medicine, Building, Armor, Misc |
| Rarity | Enum | Common, Uncommon, Rare, Epic, Legendary |
| Icon | Texture2D | Item icon for UI |
| World Mesh | StaticMesh | Mesh for dropped items |
| Property | Default | Description |
|---|---|---|
| Max Stack Size | 1 | How many can stack in one slot (1 = not stackable) |
| Weight | 1.0 | Weight per unit (affects carry capacity) |
| Base Value | 0 | Value for trading systems |
| Property | Default | Description |
|---|---|---|
| Can Use | false | Can this item be consumed? |
| Use Effects | [] | Array of effects when consumed (see Effect Types below) |
| Property | Default | Description |
|---|---|---|
| Can Equip | false | Can this item be equipped? |
| Weapon Damage | 0 | Damage dealt if weapon |
| Attack Speed | 1.0 | Attack speed multiplier |
| Attack Range | 150 | Attack range in cm |
When defining Use Effects for consumable items:
Add item to inventory. Returns amount actually added (may be less if inventory full or weight limit).
Remove item from inventory (searches all slots). Returns amount actually removed.
Remove item from specific slot index.
Check if player has at least Quantity of Item ID.
Get total count of item across all slots.
Get slot data at index (ItemID, Quantity, Durability).
Swap contents of two slots. Use for drag-drop in UI.
Split Amount items from Source to Target slot.
Select hotbar slot (0-7 typically).
Scroll hotbar selection up or down.
Get ID of currently selected hotbar item.
Query weight status. Weight Percentage returns 0-1+ (can exceed 1 if overweight).
Use/consume item in slot. Applies effects to Needs Component.
Use currently selected hotbar item.
Drop item from slot into world.
| Event | Parameters | When It Fires |
|---|---|---|
| On Inventory Changed | Slot Index, New Slot Data | Any slot changes |
| On Item Added | Item ID, Quantity | Items added to inventory |
| On Item Removed | Item ID, Quantity | Items removed from inventory |
| On Hotbar Selection Changed | New Index | Hotbar selection changes |
| On Weight Changed | New Weight | Total weight changes |
The needs system manages survival stats like health, hunger, thirst, and stamina with automatic drain, regeneration, and threshold effects.
Built-in need types (plus 3 custom slots):
Each need in your Needs DataTable has these properties:
| Property | Default | Description |
|---|---|---|
| Need Type | Health | Which need this defines |
| Display Name | - | Name shown to player |
| Enabled | true | Is this need active in your game? |
| Max Value | 100 | Maximum value for this need |
| Starting Value | 100 | Value at game start |
| Property | Default | Description |
|---|---|---|
| Drains Over Time | true | Does this need decrease automatically? |
| Base Drain Rate | 0.1 | Points lost per second |
| Sprint Drain Multiplier | 2.0 | Drain multiplier when sprinting |
| Jump Drain Multiplier | 1.5 | Drain multiplier when jumping |
| Property | Default | Description |
|---|---|---|
| Regenerates Over Time | false | Does this need increase automatically? |
| Base Regen Rate | 0.0 | Points gained per second |
| Regen Only When Idle | false | Only regen when not moving |
| Resting Regen Multiplier | 5.0 | Regen multiplier when resting/sleeping |
Define effects that trigger at certain levels (e.g., "when hunger below 25%"):
| Property | Description |
|---|---|
| Threshold Value | Percentage (0-100) where effect triggers |
| Trigger When Below | true = triggers below value, false = above |
| Notification Message | Message shown to player |
| Speed Multiplier | Movement speed modifier (0.5 = 50% speed) |
| Damage Per Second | Health damage while in this state |
| Stamina Drain Multiplier | Stamina drain modifier |
| Vision Effect Intensity | Post-process effect strength (0-1) |
| Property | Default | Description |
|---|---|---|
| Fatal At Zero | false | Does reaching 0 kill the player? |
| Death Message | - | Message shown when this need kills player |
Get current, max, or percentage (0-1) of a need.
Check if need is below 25% (critical) or at 0 (depleted).
Add or subtract from need. Positive = add, negative = subtract.
Set need to exact value.
Restore need(s) to maximum value.
Shortcut to damage health.
Shortcut to restore health.
Shortcuts for health queries.
Consume stamina. Returns false if not enough stamina.
Check if have at least Amount stamina.
Get combined effects from all active thresholds. Use to modify movement speed, apply damage, etc.
| Event | Parameters | When It Fires |
|---|---|---|
| On Need Changed | Need Type, New Value, Max Value | Any need value changes |
| On Need Threshold Reached | Need Type, Threshold Index | Player enters a threshold zone |
| On Need Depleted | Need Type | Need reaches 0 |
| On Player Death | - | Player dies (any cause) |
The crafting system handles recipes, ingredients, crafting stations, and production.
| Property | Description |
|---|---|
| Recipe ID | Unique identifier |
| Display Name | Name shown in crafting menu |
| Category | Tools, Weapons, Armor, Building, Food, Medicine, Resources, Misc |
| Required Station | None (hand), Workbench, Forge, Campfire, Anvil, Cauldron, etc. |
| Ingredients | Array of (Item ID, Amount) pairs |
| Result Item ID | Item produced |
| Result Amount | Quantity produced |
| Crafting Time | Seconds to craft (0 = instant) |
| Unlocked By Default | Available from start? |
| Required Level | Level needed to unlock |
Begin crafting a recipe. Consumes ingredients and starts timer.
Craft immediately (ignores crafting time). Good for quick hand-crafting.
Cancel current crafting (ingredients NOT returned).
Check if can craft: has ingredients, at correct station, recipe unlocked.
Check if player has all required ingredients.
Call when player interacts with crafting station.
Get recipes that can be crafted now (unlocked, correct station, has ingredients).
Unlock a recipe for the player.
| Event | Parameters | When It Fires |
|---|---|---|
| On Crafting Started | Recipe ID, Crafting Time | Crafting begins |
| On Crafting Progress | Recipe ID, Progress (0-1) | Every tick while crafting |
| On Crafting Completed | Recipe ID | Item crafted successfully |
| On Crafting Cancelled | Recipe ID | Crafting was cancelled |
| On Recipe Unlocked | Recipe ID | New recipe learned |
The building system handles structure placement, preview, validation, and demolition.
Switch between build mode, demolish mode, and normal gameplay.
Select building piece to place.
Update preview position based on camera. Call every frame in build mode.
Rotate building preview by degrees.
Place building at current preview location.
Demolish a building actor. Returns some materials.
Check if player has required materials.
| Event | Parameters | When It Fires |
|---|---|---|
| On Build Mode Changed | NewMode (ESurvivalBuildMode) | Mode switches |
| On Building Selected | BuildingID (FName) | Building piece selected |
| On Building Placed | BuildingID (FName), InstanceID (int32), PlacedActor (AActor*) | Building placed successfully |
| On Building Demolished | InstanceID (int32), DemolishedActor (AActor*) | Building destroyed |
| On Placement Valid Changed | bIsValid (bool) | Preview validity changes |
Demolish building by instance ID (for hybrid HISM system).
Get HISM instance ID under cursor (for hybrid system).
The Hybrid Building System dramatically improves scalability by using HISM (Hierarchical Instanced Static Mesh) for static buildings and Actors only for interactive elements.
| Metric | Actors Only | Hybrid System |
|---|---|---|
| Max Elements | ~2,000 | 50,000+ |
| Draw Calls (10k elements) | ~10,000 | ~50 |
| Memory (10k elements) | ~1GB | ~100MB |
| Network Overhead | High | Low |
The system automatically routes building placement:
1 Place ASurvivalBuildingManager in your level (one per map)
2 Assign Building Data Table to the manager
3 Ensure bUseHybridSystem = true on Building Components (default)
4 Done! Building Component auto-finds the manager
Automatically chooses HISM or Actor based on category. Returns InstanceID (positive for HISM, 0 for Actor).
Force HISM placement (ignores category).
Force Actor spawn (ignores category).
Remove HISM instance by ID.
Remove building closest to location (checks both HISM and Actors).
Apply damage to HISM instance. Auto-removes at 0 health.
Repair HISM instance.
Check if category spawns as Actor (not HISM).
Find HISM instance near a world location.
Get all instances of a specific building type.
Get total counts for each type.
Returns array of all HISM instances for serialization.
Restore all HISM instances from saved data. Clears existing first.
Remove all buildings (both HISM and Actors).
| Event | Parameters | When It Fires |
|---|---|---|
| OnStaticBuildingPlaced | InstanceID (int32), BuildingID (FName) | HISM instance added |
| OnStaticBuildingRemoved | InstanceID (int32), BuildingID (FName) | HISM instance removed |
| OnStaticBuildingDamaged | InstanceID (int32), CurrentHealth (float), MaxHealth (float) | HISM instance damaged/repaired |
| Property | Type | Description |
|---|---|---|
| InstanceID | int32 | Unique ID within the HISM pool |
| BuildingID | FName | Reference to DataTable row |
| Transform | FTransform | World transform |
| Health | float | Current health |
| OwnerID | FGuid | Player who placed it |
| PlacedTimestamp | int64 | Unix timestamp when placed |
By default, these categories spawn as Actors:
To modify, edit InteractiveCategories TSet on the Building Manager:
HISM automatically uses Nanite if your meshes have it enabled. No additional setup required.
Enable Nanite on all building meshes for best performance with large bases. HISM + Nanite = virtually unlimited static buildings.
To disable hybrid system and use Actors for everything (v1.0 behavior):
Harvest trees, rocks, bushes, and other resources painted with UE5's Foliage Tool — no need to convert them to individual Actors.
UE5 Foliage uses Instanced Static Meshes for extreme performance — thousands of trees with minimal draw calls. This system lets you harvest those instances directly, keeping the performance benefits while adding full survival gameplay.
1 Place ASurvivalFoliageManager in your level (one per map)
2 Assign your Resources DataTable (same one used by SurvivalResourceActor)
3 Create Mesh Mappings: for each foliage mesh, assign a ResourceID
4 Paint foliage normally with UE5 Foliage Tool
5 In your Character, do a line trace and call HarvestFromHitResult()
Each foliage mesh must be mapped to a ResourceID. For example: SM_Oak_Tree → "Oak_Tree", SM_Rock_Large → "Rock_Large". Multiple mesh variants can map to the same ResourceID.
| Property | Default | Description |
|---|---|---|
| ResourcesDataTable | None | Same DataTable as SurvivalResourceActor (FSurvivalResourceData rows) |
| MeshMappings | [] | Array of (FoliageMesh → ResourceID) pairs |
| HitSearchRadius | 100.0 | Search radius for finding foliage near hit location (cm) |
| bAutoDiscover | true | Auto-scan level for matching foliage at BeginPlay |
| StumpMeshes | {} | Optional: spawn stump/rubble mesh when resource depleted |
Pass line trace result directly. Handles everything: tool check, damage, drops, depletion.
Manual harvest with explicit component and index.
Apply damage without giving drops (fire, explosions, etc.)
Check if a hit component is managed foliage, and get its ResourceID.
Check if foliage at location can be harvested with given tool.
Query foliage stats for UI or debugging.
Force respawn depleted foliage. Automatic respawn uses RespawnTime from DataTable.
Returns only damaged/depleted instances. Untouched foliage is NOT saved (minimal save data).
Restore depleted foliage from save. Matches by location (50cm tolerance).
| Event | Parameters | When It Fires |
|---|---|---|
| OnFoliageHit | InstanceIndex, RemainingHealth, MaxHealth | Foliage instance takes damage |
| OnFoliageDepleted | InstanceIndex, ResourceID | Foliage fully harvested (HP=0) |
| OnFoliageRespawned | InstanceIndex, ResourceID | Foliage respawned after timer |
| Property | Type | Description |
|---|---|---|
| InstanceIndex | int32 | Index in the ISM component |
| ResourceID | FName | Reference to Resources DataTable row |
| CurrentHealth | float | Current health |
| MaxHealth | float | Max health from DataTable |
| Transform | FTransform | World transform of instance |
| bIsDepleted | bool | Is this instance harvested? |
| RespawnTimer | float | Seconds until respawn (-1 = no respawn) |
1 Create a new Actor Blueprint
2 Add a Static Mesh component
3 Add a Sphere Collision component
4 Create variables: Item ID (Name), Quantity (int)
1 Create Actor Blueprint with mesh and health variable
2 Create interface or direct function for "Harvest"
3 On harvest: subtract health, give resource, destroy when depleted
1 Create Actor Blueprint with mesh and interaction trigger
2 Create variable: Station Type (ESurvivalCraftingStation)
3 On interact: call Set Active Station on player's Crafting Component
1 Place ASurvivalBuildingManager Actor in your level
2 Assign your Building DataTable to the manager
3 Ensure bUseHybridSystem = true on SurvivalBuildingComponent (default)
4 Component auto-finds manager in BeginPlay - done!
1 Place ASurvivalFoliageManager in your level
2 Assign Resources DataTable and create Mesh Mappings
3 Paint foliage normally with UE5 Foliage Tool
4 In Character Blueprint: line trace → call HarvestFromHitResult
| Enum | Values |
|---|---|
| ESurvivalItemCategory | None, Resource, Tool, Weapon, Food, Drink, Medicine, Building, Armor, Misc |
| ESurvivalItemRarity | Common, Uncommon, Rare, Epic, Legendary |
| ESurvivalEffectType | None, RestoreHealth, RestoreHunger, RestoreThirst, RestoreStamina, DamageHealth, IncreaseHunger, IncreaseThirst, BuffSpeed, BuffStrength, BuffDefense |
| ESurvivalNeedType | Health, Hunger, Thirst, Stamina, Sleep, Temperature, Oxygen, Radiation, Sanity, Custom1, Custom2, Custom3 |
| ESurvivalCraftingStation | None, Workbench, Forge, Campfire, Anvil, Cauldron, SawMill, Loom, Furnace, ChemistryTable |
| ESurvivalRecipeCategory | All, Tools, Weapons, Armor, Building, Food, Medicine, Resources, Misc |
| ESurvivalBuildingCategory | Foundation, Wall, Floor, Roof, Door, Window, Stairs, Fence, Furniture, Crafting, Storage, Decoration |
| ESurvivalBuildMode | None, Building, Demolishing |
| Structure | Purpose |
|---|---|
| FSurvivalItemData | Item definition (DataTable row) |
| FSurvivalItemEffect | Effect from consuming item |
| FSurvivalInventorySlot | Single inventory slot (ItemID, Quantity, Durability) |
| FSurvivalNeedData | Need definition (DataTable row) |
| FSurvivalNeedState | Runtime need state |
| FSurvivalNeedThresholdEffect | Effect at need threshold |
| FSurvivalCraftingRecipe | Recipe definition (DataTable row) |
| FSurvivalCraftingIngredient | Recipe ingredient (ItemID, Amount) |
| FSurvivalBuildingData | Building piece definition (DataTable row) |
| FSurvivalGameSettings | Global game settings |