Unity Utils by kirillsmirnov1 - 1


Useful unity utilities

Unknown VersionUnknown LicenseUpdated 3 days agoCreated on September 8th, 2020
Go to source

Some little pieces of code I find useful enough to have them in several projects.

To install add next line to Packages/manifest.json
"trulden.unity-utils": "https://github.com/kirillsmirnov1/unity-utils.git",

Depends on:
"com.domybest.mybox": "https://github.com/Deadcows/MyBox.git",


Component to change scale of object with one slider.


LazyFade component fades in and out all child components with Color. You can pass callback to SetVisibility() to be called when fade animation is finished.

UiFadePanel is helper component for LazyFade. Show() sets LazyFade child active and calls it’s SetVisibility(). Hide() does the opposite thing. Accepts finish callbacks similar to LazyFade.


NamedArrayAttribute displays array indexes as given enum values.



Allows to «click» on button from code using Invoke().


FitCamera fits orthographic camera to chosen object in scene by width/height with chosen coefficient.


Call DateChecker.CheckSaveDate(DateTime) to check if any amount of days passed since date in question. If that is so, DateChecker.LoadOnNewDateCallback will be invoked. If not — DateChecker.LoadOnSameDateCallback.

With SaveIO you can write (and read) objects as JSON strings to (from) persistentDataPath.



CheckNullFields(MonoBehaviour o) puts warnings in console, if object in questions has some public or private serialized fields being null.


InPrefabScene() checks if current object is in prefab scene. I use it in pair with CheckNullFields().

LINQ extensions

IEnumerable<T> Shuffle<T>() shuffles IEnumerable. It does so by calling OrderBy with some random values;


RandomValueInRangeSegment(float from, float to, int segmentCount, int segmentIndex)
Separates [from, to] to segmentCount ranges and generates random value in segmentIndex range.


DrawCross(Vector3 pos, float time, float length) draws debug cross


T Next<T>(this T src) where T : Enum returns next enum element. For last element returns first one.

Show all projects by kirillsmirnov1