A lightweight collection of Unity utility classes extension methods, singleton base classes, coroutine helpers, and vector math packaged for the Unity Package Manager.
Everything lives under a single namespace:
using UnityUtils;-
Open Window → Package Manager.
-
Click + → Add package from git URL…
-
Enter:
https://github.com/kureysalp/Unity-Utility.git
Alternatively, add the dependency directly to Packages/manifest.json:
{
"dependencies": {
"com.kureysalp.unity-utility": "https://github.com/kureysalp/Unity-Utility.git"
}
}Requires Unity 2021.3 or newer.
Fluent extension methods for the types you touch every day:
- GameObject / Transform -
GetOrAdd,OrNull, hierarchy paths, recursive layer setting, child enable/disable/destroy, pose get/set, and more. - Vector3 - component-wise
With/Add/ComponentDivide, range checks, random offsets, points in an annulus, grid quantization. - Rigidbody - redirect velocity while preserving speed, stop instantly (Unity 6
linearVelocityaware). - Camera - viewport extents with margin for frustum culling.
- String - null/blank checks, slicing, alphanumeric conversion, and rich-text formatting helpers.
- List / IEnumerable -
Shuffle,Swap,Filter,Clone,ForEach, and allocation-awareRandomselection. - Numbers / Mathf -
Remap,AtLeast/AtMostclamping, odd/even checks, approximate comparison, andMin/Maxfor extra numeric types.
Base classes for MonoBehaviour singletons:
Singleton<T>- auto-instantiating, scene-scoped singleton.PersistentSingleton<T>- survives scene loads viaDontDestroyOnLoad, with optional auto-unparenting.
WaitFor- cachedWaitForSeconds/WaitForFixedUpdate/WaitForEndOfFrameinstructions to cut per-frame GC allocations in coroutines.
VectorMath- static helpers for signed angles on a plane, dot-product projection, projecting points onto lines, rotating vectors onto planes, and more.
If the Unity.Mathematics package is present, extra half-typed overloads in the numeric helpers are enabled automatically through the ENABLED_UNITY_MATHEMATICS define — no configuration required.
Released under the MIT License. See LICENSE.