Coder Social home page Coder Social logo

unityeditorjunkie's Introduction

UnityEditorJunkie

Unity code that gets you that sweet editor scripting fix. Unity did a pretty good job building out a massive editor... but there are a few holes. Lets fill them one by one.

SearchableEnum

Use the SearchableEnumAttribute on an enum to get an improved enum selector popup. This has a text search box to filter the list, scrolls like a real scroll list, works with keyboard navigation, and focuses on the current selection when opening.

Use it on something like Unity's KeyCode to be less likley to want to kill yourself when trying to pick something at the bottom of the list.

Example

public class SearchableEnumDemo : ScriptableObject
{
    [SearchableEnum]
    public KeyCode AwesomeKeyCode;
}

popup image

SceneReference

Loading a scene in Unity normally requires a string name or index which can easily break. By using a SceneReference on your MonoBehaviour, you can hard reference a scene and get validation features.

QuickButtons

Draw buttons in the inspector without writing any editor code.

Example

public class QuickButtonsDemo : MonoBehaviour
{
    /// <summary>
    /// This draws a button in the inpsector that calls 
    /// OnDebugButtonClicked on click.
    /// </summary>
    public QuickButton NameButton = new QuickButton("OnDebugButtonClicked");
    
    /// <summary>
    /// This draws a button in the inpsector that invokes a  
    /// delegate on click.
    /// </summary>
    public QuickButton DelegateButton = new QuickButton(input =>
    {
        QuickButtonsDemo demo = input as QuickButtonsDemo;
        Debug.Log("Delegate Button Clicked on " + demo.gameObject.name);
    });
    
    private void OnDebugButtonClicked()
    {
        Debug.Log("Debug Button Clicked");
    }
}

popup image

unityeditorjunkie's People

Contributors

roboryantron avatar shiena avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.