Home

Awesome

<h1 align="center">Welcome to GuiUtils 👋</h1> <p> <a href="https://www.apache.org/licenses/LICENSE-2.0.txt" target="_blank"> <img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" /> </a> <a href="https://github.com/Rhinox-Training/rhinox-guiutils/pulls"><img src="https://camo.githubusercontent.com/39f0f598b3d29424cde0684dbfe69f5a313b84bc2bf9e72f9c2cede374c82d80/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d626c75652e737667" alt="PRs Welcome" data-canonical-src="https://img.shields.io/badge/PRs-welcome-blue.svg" style="max-width: 100%;"></a> <a href="https://openupm.com/packages/com.rhinox.open.guiutils/" target="_blank"> <img alt="openupm" src="https://img.shields.io/npm/v/com.rhinox.open.guiutils?label=openupm&registry_uri=https://package.openupm.com" /> </a> </p>

GUI Utils for Unity projects, mostly Editor extensions. (Optional Odin extensions)

Install

This package is being hosted on openupm. If you have their CLI installed you can use the following command.

openupm install com.rhinox.open.guiutils

If not, you can manually edit the manifest.json (as described on the openupm page) or install it as a git package using the following url: https://github.com/Rhinox-Training/rhinox-guiutils?path=/Assets/GUIUtils

Dependencies

Content

GuiUtils offers shortcuts and extensions for making editors in Unity. It contains many baseclasses, methods of making custom GUI, and an entire system of creating drawers for unknown types. It uses a stub of Odin attributes to provide an array of utility (much less than Odin but still a fair amount) to your inspector without creating a custom drawer. When Odin is included, it seamlessly lets odin handle all drawing (you might need to restart Unity). It builds further upon Lightspeed and works as the basis of our other core package: Utilities.

Please explore the code for a proper overview but here's a quick sample:

Various Base classes

Various utilities

Custom Drawer system

You can mark any Monobehaviour/ScriptableObject class with the [SmartFallbackDrawn] attribute to make it be drawn with our custom system. Doing this will provide support for an array of Odin attributes, and cause (serialized/visible) fields that unity does not draw, to be exposed.

It was/is intended as a (very basic) open-source fallback version for Odin Inspector that allows you to expose some of its functionality to end users that do not have it available.

We've chosen to not make this automatic as there are still some issues to kink out. You can also 'preview' the change by clicking the wand icon.
Wand Icon

You can make any object draw with a simple

var drawable = DrawableFactory.CreateDrawableFor(o);
drawable.Draw(GUIContent.none);

Supported Odin Attributes

Quick note in advance: there is no support expressions in attribute string params like Odin does, and I'm not really planning to add it. We do provide support for paths and some custom values (i.e. $property, $value, ...). We've named our systems variables the same as Odin (where applicable) so you can use them with both systems. i.e. $property.Parent will work.

Custom attributes

Optional dependencies

Contribution guidelines

See the Utilities package if you are interested in contributing something along those lines.

Show your support

📝 License

This project is Apache--2.0 licensed.

Parts of the code come from external authors or are being reused from other open source projects: