Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.vulpes.objectpool

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.vulpes.objectpool

A lightweight Object Pooling solution for Unity.

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Vulpes Pooling

A lightweight Object Pooling solution for Unity.

As of version 1.0.0 of this package, you are now able to install it, along with other Vulpes Software packages via the Unity Package Manager.

In Unity 2019 LTS and Unity 2020 onwards you can install the package through 'Project Settings/Package Manager'. Under 'Scoped Registries' click the little '+' button and input the following into the fields on the right.

Name: Vulpes Software URL: https://registry.npmjs.org Scope(s): com.vulpes

Click 'Apply', now you should be able to access the Vulpes Software registry under the 'My Registries' section in the Package Manager window using the second dropdown in the top left.

How do I use this package?

  • This Pooling solution is designed to operate in a fire and forget fashion.
  • To create a pool of objects simply call 'Pool.Add(GameObject, int*)' with the desired Prefab as the main arg and optionally the number of instances to generate in the pool (for example you may want to add projectiles to the pool based on a weapon's fire rate for optimal results).
  • To spawn an object simply call 'Pool.Spawn(GameObject, Vector3*, Quaternion*, Transform*)' with the desired Prefab as the main arg, you can opptionally specify a position, rotation, and parent transform.
  • To Despawn something simply call 'Pool.Despawn(GameObject)' with the desired instance as the main arg, if you attempt to Despawn something that isn't tracked by the Pool it will simply be Destroyed.
  • To Remove a pool of objects simply call 'Pool.Remove(GameObject)' with the desired Prefab as the main arg, this will clear all inactive instances of the target object from the pool, any active instances will be simply be Destroyed when Pool.Despawn is called on them.
  • Additionally an interface called 'ISpawnable' can be implemented into any class and the OnSpawn and OnDespawn methods will be called when Spawning and Despawning an instance. This can be used for resetting values, physics, etc. to their default values between uses.

* - Denotes optional arguments.

Keywords

FAQs

Package last updated on 21 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc