Hirashi3630 / UrGUI

UrGUI: easy to create GUI for Unity mods and debug
MIT License
18 stars 5 forks source link
modding modding-tools unity unity-extension unity-imgui unity-modding unity-mods unity3d unity3d-plugin

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) ```cs window = GUIWindow.Begin("Custom size!", startX: 50, 50, 200, 600); ```

More Examples


Controls


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

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

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

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

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

#### DropDown dropdown_showcase ```cs var selection = new Dictionary(); 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 ```cs window.TextField("Name:", (value) => Debug.Log($"TextField has been changed to '{value}'"), "Sample Text"); ```

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

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

### Decorative
#### Separator *Horizontal line used to separate controls* ```cs window.Separator(); ```

#### Space *same as empty label* ```cs 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:

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