Skip to content

stadoblech/SwissArmyLib

 
 

Repository files navigation

Logo   SwissArmyLib

Build status Download

DocumentationAPI Reference


About

SwissArmyLib is an attempt to create a collection of useful utilities primarily intended for Unity projects, but feel free to rip parts out and use them for whatever you want.

A very important part in the design decisions of this library was to keep the garbage generation low. This means you will probably frown a little upon the use of interfaces for callbacks, instead of just using delicious delegates. It also means using the trusty old for loops for iterating through collections where possible.

There's a lot of libraries with some of the same features, but they're often walled off behind a restrictive or ambiguous license. This project is under the very permissive MIT license and we honestly do not care what you use it for.

Features

  • Events
    • Uses interfaces instead of delegates to reduce garbage
    • Can be prioritized to control call order
    • Check out GlobalEvents if you need.. well.. global events.
  • Timers
    • Supports both scaled and unscaled time
    • Optional arbitrary args to pass in
    • Also uses interfaces for callbacks to avoid garbage
  • Coroutines
    • More performant alternative to Unity's coroutines with a very similar API.
  • Automata
  • Pooling
    • Support for both arbitrary classes and GameObjects
    • IPoolable interface for callbacks
      • PoolableGroup component in case multiple IPoolable components needs to be notified
    • Timed despawns
  • Service Locator
    • An implementation of the Service Locator pattern
    • Aware of MonoBehaviours and how to work with them
    • Supports scene-specific resolvers
    • Supports both singletons and short-lived objects
      • Singletons can be lazy loaded
  • Managed Update Loop
  • Spatial Partitioning
    • GC-friendly implementations of common space-partitioning systems
  • Resource Pool
    • Generic and flexible resource pool (health, mana, energy etc.)
  • Gravity
    • Flexible gravitational system
    • Useful for planet gravity, black holes, magnets and all that sort of stuff.
  • Misc

Download

Binaries for the bleeding edge can be found here. Alternatively you can either build it yourself (very easily) or simply copy the source code into your Unity project and call it a day.

License

MIT

Contributing

Pull requests are very welcome!

I might deny new features if they're too niche though, but it's still very much appreciated!

About

Collection of helpful utilities we use in our Unity projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%