Skip to content

UrGUI: easy to create GUI for Unity mods and debug

License

Notifications You must be signed in to change notification settings

Hirashi3630/UrGUI

Repository files navigation

UrGUI

License: MIT GitHub issues Workflow Badge CodeFactor

UrGUI: easy to use library to create simple UI/GUI in Unity using bult-in IMGUI system

The main focus of this project is to create an easy-to-use library for Unity, primarily used for modding and debugging purposes. By using Unity's built-in IMGUI system you can be sure this library will work with almost any version of Unity


usage-sample1


Getting Started

  1. Get UrGUI.dll
    • Download built assembly from Release page
    • Download source code and build it yourself

MelonLoader

  1. put UrGUI.dll in /UserLibs/

Usage

Quickstart

a simple menu with label and button

usage-sample1

using UrGUI.GUIWindow;

private GUIWindow window;

private void Start()
{
    window = GUIWindow.Begin("Quickstart");
    window.Label("Lorem ipsum");
    window.Button("Press me!", () => print("Button has been pressed!"));
}

private void OnGUI()
{
    window.Draw();
}
I want to set my own position and size!

(x, y, width, height)

window = GUIWindow.Begin("Custom size!", startX: 50, 50, 200, 600);

More Examples


Controls


Label

label_showcase
window.Label("Lorem ipsum dolor sit amet");



Button

button_showcase
window.Button("Press me!", () => print("Button has been pressed!"));



Slider

slider_showcase
window.Slider("Slider:", (value) => print($"Slider value is now {value}"), 0.69f, 0f, 1f, true);



Toggle

toggle_showcase
window.Toggle("Is UrGUI best?", (value) => print($"Toggle value is now {value}"), false);



ColorPicker

colorpicker_showcase
window.ColorPicker("Cube clr:", (clr) => Debug.Log($"Color has been changed to {clr}"), Color.red);



DropDown

dropdown_showcase
var selection = new Dictionary<int, string>();
for (int i = 0; i < 10; i++)
    selection.Add(i, $"Option n.{i}");

window.DropDown("Selection:", (id) => print($"'{id}'. has been selected!"), 0,  selection); 



TextField

textfield_showcase
window.TextField("Name:", (value) => Debug.Log($"TextField has been changed to '{value}'"), "Sample Text");



IntField

intfield_showcase
window.IntField("Age:", (value) => Debug.Log($"FloatField has been changed to '{value}'"), 1234);



FloatField

floatfield_showcase
window.FloatField("X:", (value) => Debug.Log($"FloatField has been changed to '{value}'"), 12.34f);



Decorative


Separator

Horizontal line used to separate controls

window.Separator();



Space

same as empty label

window.Space();


Licensing & Credits:

UrGUI is licensed under the MIT License. See LICENSE for the full License.

Third-party Libraries used as Source Code and/or bundled in Binary Form:

  • Unity Runtime Libraries are part of Unity Software. Their usage is subject to Unity Terms of Service, including Unity Software Additional Terms.

This Repository is not sponsored by, affiliated with or endorsed by Unity Technologies or its affiliates. "Unity" is a trademark or a registered trademark of Unity Technologies or its affiliates in the U.S. and elsewhere.

Used softwares