GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - QFSW/MasterObjectPooler2: Master Object Pooler 2 is a high performance, flexible and easy to use object pooling solution that can fit into any Unity project

BranchesTags
Open more actions menu

Latest commit

 

History

184 Commits
184 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
Source
Source
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CHANGELOG.md.meta
CHANGELOG.md.meta
 
 
LICENSE.md
LICENSE.md
 
 
LICENSE.md.meta
LICENSE.md.meta
 
 
README.md
README.md
 
 
README.md.meta
README.md.meta
 
 
Source.meta
Source.meta
 
 
package.json
package.json
 
 
package.json.meta
package.json.meta
 
 

Repository files navigation

Master Object Pooler 2 is a high performance, flexible and easy to use object pooling solution that can fit into any Unity project.

Full Documentation and API Reference

Unity Asset Store

Getting Started

In order to get started, create an ObjectPool for your desired object.

  • Use Create -> Master Object Pooler 2 -> Object Pool to create it at edit time
  • Use ObjectPool.CreateInstance() to create one at runtime

Once you have an ObjectPool, use pool.GetObject() and pool.Release() in place of all Instantiate and Destroy calls. This means objects will be recycled through the pool, reducing GC and greatly improving efficiency.

Using a MasterObjectPooler can greatly ease the use of managing multiple pools. Pools can be added to it either in the inspector, or at runtime with AddPool. Once added to the pool, you can use all of the normal pool functions (or retrieve the pool) with a string reference.

Extras

AutoPool is a script that can be added to any object to make it automatically pool itself after a surpassed amount of time. The parent pool is injected to the pool via the IPoolable component, so you do not need to do it yourself

You can make your own scripts that use the parent pool by implementing IPoolable

Any script deriving from or using PoolableMonoBehaviour will have a new Release method, allowing you to release the object without needing a reference to its pool

MOP2 also provides GetObjectComponent<T>, a GC free method of getting the object component. This should be used whenever possible to improve efficiency.

Installing via Package Manager

2019.3+

Starting with Unity 2019.3, the package manager UI has support for git packages

Click the + to add a new git package and add https://github.com/QFSW/MasterObjectPooler2.git as the source

2018.3 - 2019.2

To install via package manager, add the file Packages/manifest.json and add the following line to the "dependencies"

"com.qfsw.mop2": "https://github.com/QFSW/MasterObjectPooler2.git"

Your file should end up like this

{
  "dependencies": {
    "com.qfsw.mop2": "https://github.com/QFSW/MasterObjectPooler2.git",
    ...
  },
}

Install via OpenUPM

The package is available on the openupm registry. It's recommended to install it via openupm-cli.

openupm add com.qfsw.mop2

Thanks to caprapaul for logo work.

About

Master Object Pooler 2 is a high performance, flexible and easy to use object pooling solution that can fit into any Unity project

Resources

Readme
MIT license
Activity

Stars

68 stars

Watchers

5 watching

Forks

6 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.