dev.bxbstudio.utilities is a Unity utility package that groups runtime helpers, nested math/value types, serializable wrappers, editor tooling, and a small set of core patterns such as singletons and managed asset references.
- Runtime extension methods for
Transform,AnimationCurve,string,Enum, andColor - Large
Utilitysurface for units, intervals, math helpers, bounds helpers, render-pipeline checks, screenshots, and asset helpers Bezier.Pathutilities for building and sampling spline paths- File and
Resources-based binary serialization throughDataSerializationUtility<T> - Core helpers such as
BehaviourSingleton<T>,ScriptableSingleton<T>,GameLogger, andSerializedDictionary<TKey, TValue> - Managed references for scene assets and
Resourcesassets with editor drawers - Editor utilities for scripting define symbols, debug menu items, layers management, and small workflow windows
- Serializable wrapper types such as
Utility.SerializableVector2,Utility.SerializableRect,Utility.SerializableColor,Utility.SerializableAudioClip,Utility.SerializableMaterial,Utility.SerializableLight, andUtility.SerializableParticleSystem
- Unity
2020.3.17f1or newer com.unity.mathematics1.2.6
- Open
Window > Package Manager. - Select
+ > Add package from git URL.... - Enter:
https://github.com/BxB-Studio/Unity-CSharp-Utilities.git
For more setup options, see the Installation Guide.
Most consumers will use one or more of these namespaces:
UtilitiesUtilities.CoreUtilities.Core.ManagedUtilities.Editor
Important: many value types are nested inside the Utility class, so their full names are things like Utility.Interval, Utility.Interval2, Utility.SerializableColor, and Utility.ColorSheet.
using UnityEngine;
using Utilities;
public class UtilityExamples : MonoBehaviour
{
[SerializeField] private AnimationCurve throttleCurve;
private void Start()
{
Transform wheel = transform.FindContains("wheel", caseSensitive: false);
AnimationCurve safeCurve = throttleCurve.Clamp01();
if (" ".IsNullOrWhiteSpace())
{
Debug.Log(wheel ? "Wheel found" : "Wheel not found");
}
}
}using UnityEngine;
using Utilities;
public class IntervalExample : MonoBehaviour
{
private void Start()
{
Utility.Interval suspensionTravel = new Utility.Interval(0f, 0.2f);
float halfTravel = suspensionTravel.Lerp(0.5f);
string metric = Utility.NumberToValueWithUnit(27f, Utility.Units.Speed, Utility.UnitType.Metric, 1);
Debug.Log($"{halfTravel:F3} m, {metric}");
}
}using System;
using UnityEngine;
using Utilities;
[Serializable]
public class PlayerSaveData
{
public string playerName;
public int score;
}
public class SaveExample : MonoBehaviour
{
private readonly DataSerializationUtility<PlayerSaveData> serializer =
new DataSerializationUtility<PlayerSaveData>("SaveData/Player.dat", false, bypassExceptions: true);
private void Start()
{
serializer.SaveOrCreate(new PlayerSaveData
{
playerName = "Player 1",
score = 9000
});
PlayerSaveData loaded = serializer.Load();
Debug.Log(loaded != null ? loaded.playerName : "No save file");
}
}using UnityEngine;
using Utilities.Core;
using Utilities.Core.Managed;
public sealed class AudioManager : BehaviourSingleton<AudioManager>
{
public override bool Persistent => true;
}
public class PrefabSpawner : MonoBehaviour
{
[SerializeField] private ResourcesReference<GameObject> prefabReference;
private void Start()
{
GameObject prefab = prefabReference.Load();
if (prefab != null)
Instantiate(prefab);
}
}#if UNITY_EDITOR
using UnityEditor;
using Utilities.Editor;
public static class UtilityEditorExample
{
[MenuItem("Tools/Utilities/Examples/Add Gameplay Layer")]
private static void AddGameplayLayer()
{
if (!LayersManager.LayerExists("Gameplay"))
LayersManager.AddLayer("Gameplay");
EditorUtilities.AddScriptingDefineSymbol("GAMEPLAY_LAYER_READY");
}
}
#endifThe package adds several menu-driven utilities under Tools/Utilities, including:
- Units Converter
- Wheel Radius Calculator
- GameObject bounds and mesh debugging
- Place selected object on the zero surface
- Texture2DArray export helpers
This project is licensed under the MIT License. See LICENSE.md.
Developed by BxB Studio