Z Core Unity by zambari - 8


Some utilities and extensions I tend to use all the time

Unknown VersionUnknown LicenseUpdated 2 years agoCreated on January 24th, 2018
Go to source


As my zMisc repo was starting to grow uncontrollably, I decided to extract the core scripts I use most, and place them in a seperate repo.

Features still present are:

Selection Bookmarks

selection screenshot

An EditorWindow that lets you remember a number of gameObjects and quickly switch active selection between them. You can also Ping (highlight in hierarchy without selection) a given object to make sure this is the one you want to select, rearrange favourites, and toggle gameobjects on and off

Select objects named the same

selection screenshot

How many times you had to make the same change to dozens od objects somewhere in the hierarchy tree, that happened to be called exactly the same. Too many times. This simple tool crawls the hierarchy in the editor and selects objects named the same, like Text or Image or Button, up to a desired depth up the tree (not to select ALL THE objects, but only ones within a given depth limit from currently selected

RectExtensions / zExtensons

A large and fast growing collection of extension methods, out of which probably the most useful ones are for working with RectTransform (RectTransform extensions), theres shortcuts for setting just one dimension x/y for a rect - setSizeX, setLocalX, setRelativeLocalY, setRelativeSizeX (relative ones take 0-1 values and take into account the parent rect size), theres a whole set of Anchor setting methods (the min/max convention used in unity just consfues me so theres setAnchorRight, setAnchorLeft, setAnchorX, setPivotX etc theres GameObject[] getChildren, Transfom.RemoveChildren(), Color.Random(), Color.Alpha(float), rectTransform.AddChild (will make sure it streches), and some other stuff, it just grows

Hierarchy tools


I am not a great fan of some default behavious of UnityEditor, for exapmle why does duplicating an object moves it to the bottom of the current hierarchy level (now you can duplicate in place - leaving the clone as next sibling to active object), there’s plaste in place (keeps localposition instead of absolute position), create a duplicate of the object but without its children, hiding objects from a given layer in hierarchy (via HideFlags), Duplicate in place, Paste as child, create Image child,

Event Extensions

An ever growing collection of smail tools meant to ease the proces of wiring an event network in Unity Editor without having to create a new file for evry tiny bit of functionality.

event_extensions screenshot

Starting from a set of UnityEvent() definitons, such as FloatEvent (an equivalent of for example SliderEvent), StringEvent (useful to distribute strings) etc, we move on to some basic logic functionality (like EventGate, which triggers either one event, or another, based on some logic state, that is of course changable via other events), touching some very useful tiny scripts that take an integer (or a float which is rounded to int) and if they have a children wich such sibling number, it gets activated, while other children get deactivated), ending on quite flexible Event Processor, which basically performs a y=(x+a)*b+c operation of floats, with a b d c settable via function calls, so you can take for example a slider value, add 0.1f to it, multiply by 0.9f and trigger another FloatEvent with a processed value.

event_extensions screenshot

The list is likely to grow as I keep using them in projects.

Show all projects by zambari