ORK Framework Logo - RPG Editor for Unity
  • ORK 4 BETA
  • Features
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK

ORK 4 Documentation

  • Getting Started
    • Welcome
    • First Steps (Unity)
  • Features
    • The Status System
    • Schematics
    • Schematic Nodes
    • Dialogue Importer
    • Variables
    • Selected Data
  • Components
    • Battle Components
    • Combatant Components
    • Control Components
    • Cursor Prefab Components
    • Game Starters
    • Interactable Components
    • Move AI Components
    • Scene Setup Components
  • Editor
    • The ORK 4 Editor
    • Sections & Sub-Sections
    • Node Editor
    • Schematic Editor
    • Asset Sources
    • Unity Overlay Toolbar
  • Section: System
    • System Settings
    • Languages
    • Organizer Types
    • Game States & Conditions
    • General Condition Templates
    • Object Pools
    • Prefab Savers
    • Scene Connections
  • Section: Controls
    • Game Controls
    • Interaction Settings
    • Player Controls
    • Camera Controls
    • Input Keys
    • Control Maps
    • Camera Positions
    • Battle Camera
  • Section: Gameplay
    • Game Settings
    • Formulas
    • Difficulties
    • Shortcut Slots & Settings
    • Custom Settings & Global Custom Settings
    • Global Machines
    • Machine Templates
  • Section: Status
    • Status Values
    • Status Effects
    • Attack Modifiers
    • Defence Modifiers
    • Abilities & Ability Developments
    • Status Developments
    • Research Trees
    • Damage Types
    • Status Bonuses & Templates
    • Status Condition Templates
  • Section: Inventory
    • Inventory Settings
    • Inventory Containers
    • Currencies
    • Items
    • AI Rulesets
    • Crafting Recipes
    • Equipment Slots & Slot Set Templates
    • Equipment & Available Equipment Templates
    • Shops
    • Loot
  • Section: Combatants
    • Combatants
    • Combatant Groups
    • Class Slots
    • Classes
    • Factions & Faction Benefits
    • Animations
    • Move AIs
    • Formations
    • Action Combos
  • Section: Battles
    • Battle Systems
    • Turn Based Battles
    • Active Time Battles
    • Real Time Battles
    • Phase Battles
    • Battle Spots
    • Battle AIs
    • Battle Actions Settings
    • Special Commands Settings
    • Target Settings
    • Target Selection Templates
    • Battle Range Templates
    • Battle Grid Settings
    • Battle Grid Highlights
    • Battle Grid Cell Types
    • Battle Grid Formations
  • Section: Content
    • Content Types
    • Music
    • Sound Templates
    • Areas
    • Teleports
    • Quests & Quest Tasks
    • Logs & Log Texts
    • Object Contents
  • Section: UI
    • UI Settings
    • UI Layers
    • UI Layouts
    • UI Boxes
    • HUDs
    • Notifications
    • Cursor Settings
  • Section: Menus
    • Start Menu
    • Save Game Settings
    • Option Categories
    • Menu Screens
    • Menu Requirements
    • Battle Menus
    • Loot Dialogues
    • Item Collection
    • Combatant Selections
    • Quantity Selections
    • Shop Layouts
  • Section: Texts
    • Text Settings
    • Formatting Settings
    • Flying Texts
    • Use Cost Display
    • Status Preview Display
    • Bonus Display
    • Status Change Display
    • Console Settings & Console Types
    • Text Codes
  • Sections: Editor
    • Editor Settings
    • Backups
    • Variables
    • Plugins
  • Scripting
    • Access Handler
    • Custom Nodes
    • Custom Save Data
    • Custom Component Save Data

ORK 4 Tutorials

  • ORK 4 Unity Quickstart Tutorials (3D)
    • ORK 4 Unity Quickstart 3D
    • 01 Initial ORK Setup
    • 02 Player Setup
    • 03 Music & Scenes
    • 04 UI System Setup
    • 05 UI Boxes
    • 06 Flying Texts
    • 07 Status Values
    • 08 Status Effects
    • 09 First Abilities
    • 10 Fighter Setup
    • 11 First Enemies & Battle AI
    • 12 Battle System Setup
    • 13 Animating Battle Start and End
    • 14 Random Battles
    • 15 Animating Actions
    • 16 Player Battle HUD
    • 17 Elemental Attacks
    • 18 Animating More Actions
    • 19 Inventory & Loot
    • 20 Equipment
    • 21 Loot, Start Equipment & Viewers
    • 22 Magic Abilities
    • 23 Caster Setup
    • 24 More Enemies
    • 25 Start Menu & Save Games
    • 26 Menu Screens
    • 27 Interactions
    • 28 Item Collectors
    • This Is Not The End
    • Quickstart Extended
      • Unity UI: Interaction HUD
  • Schematics Tutorials
    • UI Animation Schematics
  • UI Tutorials
    • Unity UI: Initial Setup
    • Unity UI: Interaction HUD

ORK 4 Extensions

  • Plugins
    • Save Game Compression Plugin
  • Schematic Nodes
    • Footstepper Nodes (Unity)
  • Scripts
    • A* Pathfinding Movement Component (Unity)
    • PolyNav 2D Movement Component (Unity)
    • Cinemachine Camera Control Type (Unity)
    • Rewired Input Key (Unity)
    • Unity Legacy Input Key (Unity)
    • Core GameKit Wrapper (Unity)
    • Pool Boss Wrapper (Unity)
View Categories
  • Guide
  • ORK 4
  • ORK 4 Documentation
  • Section: System

Object Pools

Set up prefabs that should be pooled.

Object pools are found in System > Object Pools.

Object pooling can be used to increase the performance of your game and is best used for prefabs that are often spawned and destroyed, e.g. projectiles or particle effects. To use pooling in a scene, add Pool components for the pools you want to use.

Please note!

Combatant prefabs are not pooled. Each combatant instance is spawned and destroyed.

Object Pool Setup #

An object pool is based on a prefab and instantiates it when a level was loaded. The Start Size of the pool defines the quantity of objects that will be created at the start of a level. Pools can optionally grow by enabling Can Grow in the pool’s settings – this will add more objects to the pool when needed and keeps them alive, otherwise objects exceeding the pool will be destroyed again.

The pooled objects can be used by the prefabs defined in schematics. It’s only used when the prefab is defined as a resource in the schematic’s settings and has using pooling enabled. The prefab in the schematic and the pool must be the same prefab. If that’s the case, spawning and destroying a prefab in the schematic will get an object from the pool and enable/disable it instead of instantiating and destroying it.

Example #

The prefab missile is pooled with a start size of 10 and can grow.

The player’s control is handled by a schematic using the missile prefab as a resource with Use Pooling enabled. The same prefab as the pooled prefab is used, i.e. spawning this prefab will use a pooled object.

The level starts and 10 missile prefabs are instantiated and disabled immediately. The player fires missiles, they’re placed at the player’s position and enabled (Spawn Prefab node). When they hit a target or leave the screen, they’re disabled (Destroy Prefab node).

If the pool runs out of missiles, new missiles will be instantiated and added to the pool (i.e. they’ll also be enabled/disabled when used).

Using Pooling #

Pooling is a technique that will instantiate a pool of objects when a level was loaded and only enables and disables them afterwards instead of destroying them and instantiating new objects. Usually, this will help increasing the performance, but it can depend on the use case if it actually helps or has negative effects, since having a lot of objects alive in a pool (even disabled) also costs memory.

When to use Pooling #

As said, pooling costs memory for holding the objects, but increases the performance by removing the heavy instantiation and destruction of objects.

You should use pooling when objects are often created and destroyed, e.g.:

  • firing projectiles, missiles, etc.
  • particle effects

You shouldn’t use pooling for things like level architecture or procedurally generated levels, since those will most likely only be instantiated once and not destroyed until the level ends.

As noted above, combatant prefabs are not pooled.

Example #

E.g. the missiles fired by the player’s ship in a vertical space shooter are pooled. The player’s fire rate and the time a missile will be alive result in a maximum of about 15 missiles to be alive at the same time.

The pool size is 20 – this is a good use of a pool, but can also be reduced a bit.

The pool size is 100 – this is a waste of memory.

Pool Component #

The Pool component is used to add an object pool to a scene.

It’ll instantiate the selected pool’s prefab when the level was loaded (or when the component is added to the scene in a running game, e.g. spawning pools via prefabs).

Pools are only used in the scene they where added to, i.e. you need to add them to each scene they should be used in.

Table of Contents
  • Object Pool Setup
    • Example
  • Using Pooling
    • When to use Pooling
      • Example
  • Pool Component
Sitemap
  • ORK 4 BETA
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (73)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (156)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!