Common Library

, ,

A new release of my personal code library that I’ve been using in some assets and had public for a while.

What is this?

The common library contains a load of useful scripts for game development in Unity. Previously known as Scarlet Library. I’ve been adding to it as and when I found a feature I needed, wrote a solution for and found that I could use in other projects. Some bits are complete systems to aid with a specific problems while others are just helpers to save writing loads of lines of code. The library is a work in progress and will have some scripts not written fully occasionally in the code. But features are tested before they are added so it should be stable enough to use in projects.

Used in assets

I’ve been using some of this library in the asset store updates I’ve been making recently. You’ll notice the events system & serializable dictionary are in the latest Save Manager updates for example. I also use the same settings setup for storing the settings for the library as I do with assets.

Get the library

Only on GitHub:

Key elements

Some of the key features of the library so far include:

Data Setup
A setup that allows you to reference a scriptable object at runtime without a direct inspector reference. Handy if you are working with a lot of data. You just inherit from a base class that is just a standard scriptable object and your good to go.

Events System
A well used system that essentially just handles unsubscribing from a standard system action when you subscribe to it, helping to avoid over-subscription by mistake. The system also allow you to add identifies to anonymous listeners so you can remove them as well when needed if you don’t want to match the method params for the event etc.

Runtime Timers
A handy setup to let you run logic after some time. Can be used even in static classes without any issues. Handy if you can’t write a coroutine or just want some logic to run after a short pause.

Game Ticks
A handy optimisation feature that lets you run logic on update but not every frame. By listening to the tick instead you get updates every x frames instead of every frame. Helping with performance. You can use a global tick or instantiate instances for different systems.

Custom Time
Make instances of time, instead of using delta time for everything, you can set systems to use a custom time setup. Making things like pausing your game trivial without needed to pause the global timescale for everything and running into further issues due to that.

A system to help generate random numbers, with options to choose a provided from Unity Random.Range, System Random and Alea PRNG.

A handy helper setup to reference object in a scene or all scenes. Also comes with a CacheRef class to help making properties that are ensuring a reference is made if one isn’t already. Saving some typing.

Static Instancing
Love it or hate it, its handy to have some things static. You can have a class have a static reference without the whole class being static, use a base singleton class or run coroutines from a static instead generated at runtime.

Hierarchy Headers
A small editor tool to add header/separators to your hierarchy. These are really clean and easy to setup, making it easy to organize your hierarchy.

An easy way to have a popup in your game. Just inherit from panel and you’ll have ways to listen to when the panel is opened/closed and be able to track all open panels in your game.

And lots more!

There is a lot more to the library including extension methods galore, string formatting help and more. But if was to cover every script I’d be hear like all day writing this post. There is documentation some systems, but as this library is still in development, only some sections have links to documentation. When the library hits 1.x all setups will have docs, but its takes a while to write it so bare with as it gets written.

I am still working on Audio Manager 3.x as well. Currently testing to core logic as I refactored how it worked to accommodate different playing options for groups. I have also got some life admin to do over the next week or so as my car broke downโ€ฆ A bit stressful to deal with so I’ve been taking it easy the last week or so. But Still hoping to reach that end of September deadline if I canโ€ฆ.

I’ll update you’ll soon on the progress of the Audio Manager update when I have more the share. Speak to y’all soon


Leave a Reply

Your email address will not be published. Required fields are marked *