Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Free] Field, property and method inspector like UnityEvent

Discussion in 'Immediate Mode GUI (IMGUI)' started by LazloBonin, Jun 28, 2015.

  1. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    809
    I made an editor extension to easily inspect any field, property, method or animator parameter on any UnityEngine.Object. It works really similarly to UnityEvents, and it has relatively the same purpose: fast prototyping and easy decoupling.

    Here's how it looks:


    And a simple example code with the setup in the screenshot, that will print the linked variable and method result:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Reflection;
    3.  
    4. public class BasicExample : MonoBehaviour
    5. {
    6.     public UnityMethod method;
    7.  
    8.     public UnityVariable variable;
    9.  
    10.     void Start()
    11.     {
    12.         Debug.LogFormat("Method return: {0}", method.Invoke());
    13.         Debug.LogFormat("Variable value: {0}", variable.Get());
    14.     }
    15. }
    Features:
    • Inspect fields, properties and methods
    • Inspect animator parameters
    • Serialized for persistency across reloads
    • Works on GameObjects and ScriptableObjects
    • Multi-object editing
    • Undo / Redo support
    • Looks and feels like a built-in Unity component
    Limitations:
    • Doesn't support method overloading (yet)
    Installation & License:

    It's a simple folder you can import in your project. It's MIT licensed, so you can safely use it for free in your projects, even commercial games or assets.

    Link:

    The repository is hosted on GitHub here: https://github.com/lazlo-bonin/unity-reflection

    Let me know what you think! :)
     
  2. eskivor

    eskivor

    Joined:
    Aug 5, 2015
    Posts:
    13
    I'm really interested in that work. It could potentially save a lot of my time if i could incorporate it inside one of my own future editor extension. :)
    But I downloaded the folder from github to try it, moved it on a empty project in unity (2017.2.0f3) and got 8 error messages. :(
    Did you just forget to add the scripts that are inside the namespace "Ludiq.Controls.Editor", ? because its "using" lines are not recognized for the other scripts and that's probably cause the errors for "DropdownOption" and "DropdownGUI" types
     
  3. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    198
    You need to import the controls package into your project. https://github.com/lazlo-bonin/ludiq-controls
     
  4. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    198
    Hey ludiq thanks for this free package! Was just about to create my own method calling system that would expand on the unity reflection system, but this looks way better than what I could ever create.

    Cheers,