JimmysUnityUtilities
JimmysUnityUtilities copied to clipboard
A bunch of code I like to have on hand while working in Unity
Jimmy's Unity Utilities
This repository contains a bunch of code that I like to have on hand when working in Unity, although large chunks of the code aren't Unity-specific and can be used in any .NET application.
I've released everything in here as public domain, so feel free to rip out anything you find useful and use it in your own projects.
Installation
You can install JUU using the Unity Package Manager. In the top left of the UPM window, hit the "plus" button and click "add package from git URL". Then, enter https://github.com/JimmyCushnie/JimmysUnityUtilities.git.
You can also just download/clone the repo and stick it in your project's Assets or Packages folder.
Note: I update JUU frequently and I'm not shy about breaking APIs, so if you want a stable version you should probably fork it.
What's included?
By the time you're reading this list, it's probably outdated, but here's what's in JUU at time of writing:
-
Hundreds of helpful extension methods for both Unity types and .NET types
-
Color24struct, which is like Unity'sColor32but without a transparency byte -
ObjectPoolUtility<T>andTrackedObjectPoolUtility<T>classes for creating object pools -
ScriptableObjectSingleton<T>class, for creating scriptable object singletons -
NetworkPingerclass for testing connectivity to servers. Documentation here -
LockedListandLockedHashSet, thread-safe wrappers forList<T>andHashSet<T> -
AudioLoadingUtilitiesfor streaming or loading audio files on disk -
ImageUtilityclass for saving and loading images on disk -
FileUtilitiesclass with various helpful functions for working with the file system -
CoroutineUtilityclass for running coroutines from places they're usually not allowed: disabled gameobjects, static methods, code not on the main thread -
CryptographyUtilityfor hashing strings -
SceneUtilitiesclass for working with multi-scene projects -
WaitForSecondsPrecise, a version of Unity'sWaitForSecondsthat doesn't lose accuracy with repeated usage -
ClipboardAccessclass which allows you to set the contents of the system clipboard -
SimpleRotationcomponent for rotating aGameObjectat a constant speed -
CryptographyUtilityclass for hashing strings -
CustomFixedUpdate-- like Unity's FixedUpdate, but you can have many of them, and they can all have different tickrates independant from the physics simulation -
Dispatcherfor calling code on the main Unity thread from code on other threads -
JRandomclass; likeSystem.Randombut with many more methods for getting random values -
NetworkUtilitiesclass; can be used to get an available network port, and to parse IP endpoints provided by users in string form -
TerrainTextureDetectorcomponent for detecting the dominant texture at a position on a Unity Terrain object -
VisibilityDetectorcomponent for detecting when an object is in view of a Camera -
PhysicsUtilitiesclass to get collision mask of a physics layer -
ResourceUtilitiesclass to a text asset inResourcesas a string