Search Unity

Runtime Inspector and Hierarchy [Open Source]

Discussion in 'Assets and Asset Store' started by yasirkula, Oct 22, 2017.

  1. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Either there must be an error message (you can check logs) or your RuntimeHierarchy's RectTransform goes out of bounds on small resolutions, which can be fixed by setting its RectTransform anchors and/or your CanvasScaler's properties.
     
  2. Tech27

    Tech27

    Joined:
    Dec 13, 2016
    Posts:
    8
    I was getting this error. but don't known what is missing. please help.
     

    Attached Files:

  3. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Thanks for sharing the error message. After making sure that your plugin is up-to-date, can you build the game in Development Mode and then send the error message again? This time, Unity should expose the full stacktrace which will make debugging the issue easier (PS. also share your target platform, please).
     
  4. Tech27

    Tech27

    Joined:
    Dec 13, 2016
    Posts:
    8
    Thanks for the quick reply,

    my target platform is PC,Mac and Linux Standalone. By putting the build in development mode i am getting this error.

    and is it possible to provide the developement file of the following project link.
    https://yasirkula.net/DynamicPanelsDemo/
     

    Attached Files:

  5. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    I can't reproduce these errors while building to Windows standalone in Development Mode. Are you using some sort of custom build system or using the built-in "Build" or "Build&Run" buttons? Are you 100% sure that your plugin is up-to-date? Which Unity version are you using?

    Demo project is available at: https://github.com/yasirkula/UnityDynamicPanels/issues/5
     
  6. Tech27

    Tech27

    Joined:
    Dec 13, 2016
    Posts:
    8
    Hai yasirkula,
    Thanks for sharing the demo project file , you are awesome.
    The error was produce in unity version 2020.2.0f1 personal version.
    but when i use 2019.4.15f1 personal version the error was solved.
    Thanks man, really appreciate the work you are doing.
     
    yasirkula likes this.
  7. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    This is a concerning 2020.2 issue then. It might be a Unity bug or maybe deleting the plugin and then reimporting it could resolve the issue on that Unity version.
     
  8. dorianrea

    dorianrea

    Joined:
    Mar 15, 2015
    Posts:
    3
    Is there an example of how to filter out components in the inspector?
     
  9. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Code (CSharp):
    1. runtimeInspector.ComponentFilter = ( GameObject gameObject, List<Component> components ) =>
    2. {
    3.     // Simply remove undesired Components from 'components' list
    4. };
     
  10. dorianrea

    dorianrea

    Joined:
    Mar 15, 2015
    Posts:
    3
    Wow it was so simple, thank you so much. Amazing asset!
     
    yasirkula likes this.
  11. Rysiekk

    Rysiekk

    Joined:
    May 7, 2017
    Posts:
    3
    Hi there,

    In the beginning yasirkula I really appreciate your work put into this asset, really great job!

    I have one quite simple question. I'm going to create .obj editor based on your asset. Could you tell me how can I hide components such as the Main Camera, Directional Lights etc from your asset hierarchy?

    I would be so grateful for an answer.
    Best!
     
  12. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
     
    Rysiekk likes this.
  13. Rysiekk

    Rysiekk

    Joined:
    May 7, 2017
    Posts:
    3
    You are great! Thank you for the fast response, all the best to you! :)
     
    yasirkula likes this.
  14. MrFinlayW

    MrFinlayW

    Joined:
    Jan 11, 2016
    Posts:
    2
    Hi everyone. I'm making an architectural viewer in AR for my postgrad. I got tired of building everytime to see something was incorrect, so I thought this was a great tool to check things in the inspector.

    For some reason, I add both the hierarchy and inspector to my canvas and connect them. Build the project. Open in Xcode and it fails to build. I'm getting 201 errors under Apple Mach-O-Linker (Id) Error. Has anyone else had this and know a fix? Build works fine without this plugin.

    Also should add, Yasirkula, I love the tools you put out. Infact I am also using your Native Gallery screenshot functionality. Donation will be on the way soon regardless!
     
  15. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Thank you for your support! This plugin doesn't have any native code so the error message is unexpected for me. Is it possible that the error comes from NativeGallery? In any case, Xcode must have shown more detailed information about the error (most likely some sort of human readable error description). Can I see them?
     
  16. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    wolilio, Marcos-Elias and Brathnann like this.
  17. siisee11

    siisee11

    Joined:
    Sep 4, 2021
    Posts:
    3
    It is really nice asset, and easy to use thanks!
     
    yasirkula likes this.
  18. hdxpmc

    hdxpmc

    Joined:
    May 1, 2016
    Posts:
    53
    Thank you for help,

    We have already added the horizontal list. Now the problem is the item label disappear in small width of panel.
    We are studying how to use flexbox for unity to auto layout.
    How to disable the built in auto layout and use flexbox for unity ?

    Best regards
     
  19. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    There isn't a built-in flexbox solution for uGUI as far as I know. Could you share a screenshot of the label problem?
     
  20. hdxpmc

    hdxpmc

    Joined:
    May 1, 2016
    Posts:
    53



    We are going to use this: https://flexbox4unity.com/ to layout,. when resize the panel to smaller width, the title label at top row, and list at bottom row.

    And how to refresh the runtime inspector to get value to redraw again manually ? (Currently, it auto refresh every frame)
     

    Attached Files:

    Last edited: Jul 2, 2022
  21. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    RuntimeInspector benefits from uGUI's layout groups. You can add a Layout Element component to your custom InspectorField prefab, set its Min Height and Preferred Height values to the default value of 30, and then in your custom InspectorField script, override the HeightMultiplier property so that it returns 1 when everything fits in a single line and 2 when everything fits in two lines.

    There isn't a callback for when the RuntimeInspector's width changes so you'll have to check that manually in your custom InspectorField script's Update or Refresh function. When the width change affects HeightMultiplier's value, you'll unfortunately need to call OnSkinChanged function manually to propagate that change to the LayoutElement component.

    To refresh the RuntimeInspector manually, you can set its Refresh Interval to Infinity and call runtimeInspector.Refresh whenever you want. But as far as I remember, some functions force refresh the RuntimeInspector because they need it to be up-to-date. Hope that won't be an issue.
     
  22. hdxpmc

    hdxpmc

    Joined:
    May 1, 2016
    Posts:
    53
    We have used lazy list inside array to have title on top, and hide the sizeLayoutElement.
     
  23. Bluefire1234

    Bluefire1234

    Joined:
    Feb 26, 2021
    Posts:
    11
    Hello!
    Your Asset is great but I have one little question.

    How can I hide Components that are empty or don't show any variable or property?
     
  24. Bluefire1234

    Bluefire1234

    Joined:
    Feb 26, 2021
    Posts:
    11
    And how can I disable the Enabled variable on each component without disabling all bool variables?
     
  25. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    @Bluefire1234 Hi! You can register to the ComponentFilter event to remove undesired components from the Inspector. There isn't an automated way to hide empty Components but you can take note of such components that you've observed and hide them manually in that event.

    To hide Enabled property, you can add it to InternalSettings asset's (or another RuntimeInspectorSettings asset's) Hidden Variables->Object->Variables list.
     
  26. dyxwxjdy

    dyxwxjdy

    Joined:
    Mar 30, 2020
    Posts:
    15
    Thanks for this really nice asset ! When I try to hide all components, the "Is Active", "Name", "Tag", "Layer" disappear the same time. But I want to keep them, how could I do?
     
  27. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    @dyxwxjdy Hi, they are created manually by GameObjectField. In your case, I don't think GameObjectField is used anymore but I don't know why. If you're passing a Transform to Inspect function, try passing the GameObject instead.
     
  28. dyxwxjdy

    dyxwxjdy

    Joined:
    Mar 30, 2020
    Posts:
    15
    Thank you! I will give a try. And also how can I hide "scene" in Hierarchy but keep its child objects ?
     
  29. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    It's possible, I've done it in one of my projects but the system is built with the current behaviour in mind so I had to make considerable amount of modifications to change that behaviour, it wasn't trivial.
     
  30. dyxwxjdy

    dyxwxjdy

    Joined:
    Mar 30, 2020
    Posts:
    15
    Cool thanks! Expect for new version !
     
    yasirkula likes this.
  31. kukimoto0425

    kukimoto0425

    Joined:
    Nov 20, 2017
    Posts:
    12
    Hi.
    I want to hide the components in Inspector.
    You said that to register the gameObject and ComponentList in the ComponentFilter.
    In this code, I want to hide the MeshFilter but it is visible.

    Please let me know what I am doing wrong.

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3. using RuntimeInspectorNamespace;
    4.  
    5. public class EditableMenu : MonoBehaviour
    6. {
    7.     [SerializeField] RuntimeHierarchy runtimeHierarchy;
    8.     [SerializeField] RuntimeInspector runtimeInspector;
    9.     [SerializeField] GameObject gObj;
    10.  
    11.     void Start()
    12.     {
    13.         List<Component> componentsList = new List<Component>();
    14.         componentsList.Add(gObj.GetComponent<MeshFilter>());
    15.         runtimeInspector.ComponentFilter = (gObj, componentsList) =>
    16.         {
    17.             // Simply remove the undesired Components from the 'components' list
    18.          
    19.         };
    20.    }
    21. }
     
  32. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Try this:
    Code (CSharp):
    1. runtimeInspector.ComponentFilter = (gObj, componentsList) =>
    2. {
    3.     componentsList.RemoveAll(c => c is MeshFilter);
    4. };
     
    kukimoto0425 likes this.
  33. kukimoto0425

    kukimoto0425

    Joined:
    Nov 20, 2017
    Posts:
    12
    I see:)
    It's done! Thank you very much.
     
    yasirkula likes this.
  34. kukimoto0425

    kukimoto0425

    Joined:
    Nov 20, 2017
    Posts:
    12
    Please let me know how to hide "Name", "Tag" and "Layer" field.
    It seems that not controll by ComponentFilter.

    I tried to modify GenerateElement() in GameObjectField.cs, but I can't change the parameters of Transform's input field.
     
    xucian likes this.
  35. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
  36. kukimoto0425

    kukimoto0425

    Joined:
    Nov 20, 2017
    Posts:
    12
  37. kukimoto0425

    kukimoto0425

    Joined:
    Nov 20, 2017
    Posts:
    12
    Solved by myself.
    I changed the Graphics API to Direct3D11 and the above problem was solved.
    There may be other causes.:(
     
    yasirkula likes this.
  38. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    @kukimoto0425 uGUI should have no conflicts with SRPs so I'm very surprised to hear that.
     
  39. nulleye

    nulleye

    Joined:
    Jan 30, 2020
    Posts:
    3
    Hi, I quite new to all this.
    I've added and connect the inspectors, and see them on screen.
    However, I just click on any inspector and nothing happens, it is just like they are not receiving the user input.
    I'm using Unity 2021.3.25f1.
    I also have to say that I have no idea what this means:
    • add Unity.InputSystem assembly to RuntimeInspector.Runtime Assembly Definition File's Assembly Definition References list
     
  40. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    @nulleye Can you put a "UI - Event System" object to your scene, as well? If your Canvas doesn't have Canvas Raycaster component, it's also needed.
     
  41. nulleye

    nulleye

    Joined:
    Jan 30, 2020
    Posts:
    3
    Hi, thank you for the fast reply. I can't be as fast as I'm doing this in my spare time.
    The canvas has already a raycaster. I've added the UI Event System, but nothing changed
     
  42. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    An invisible UI element (with color alpha=0) might be eating the inputs. If you select the Event System object from Unity's hierarchy at runtime, you'll see in Unity's Inspector information about all the touches. From there, you can which UI element is receiving the clicks.
     
  43. nulleye

    nulleye

    Joined:
    Jan 30, 2020
    Posts:
    3
    Thanks for the tips. It has been several years since I use Unity for the last time, and I totally forgot about the Event System. Currently for the particular thing I'm doing, I was just checking the status of Input.touches in the FixedUpdate event, not using the UI event system at all. Thanks for your help and quick responses. I appreciate, it's not a common thing. Cheers
     
    yasirkula likes this.
  44. kukimoto0425

    kukimoto0425

    Joined:
    Nov 20, 2017
    Posts:
    12
    My application emits Ray from the cursor position when clicked to select an object.

    How can I prevent the Color Picker UI from penetrating the RayHit from the mouse?

    The Hierarchy and Inspector UI prevents Ray penetration with the following code

    using UnityEngine.EventSystems;.
    Code (CSharp):
    1.  
    2. using UnityEngine.EventSystems;.
    3.  
    4. void Update()
    5.     {
    6.  
    7.         //Prevent UI from being penetrated by Raycast
    8.         if (EventSystem.current.IsPointerOverGameObject()) return;
    9.  
    10.         if (runtimeHierarchy.IsSelected(this.transform))
    11.         {
    12.    // some processing
    13.   }
    14. }
     
  45. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Color picker uses uGUI so EventSystem.current.IsPointerOverGameObject() will return true for it. You'll need to call EventSystem.current.RaycastAll and check if the first element is a child of the color picker but it won't be a cheap solution. You can also try a hacky solution by adding a script with IPointerEnterHandler and IPointerExitHandler callbacks to the color picker and listen to those callbacks to see if the pointer is over that object.
     
  46. Bonnye

    Bonnye

    Joined:
    Apr 17, 2023
    Posts:
    7
    Hi, thank you for your amazing work. I would like to customize this for my school project and need help. In particular I need a list of objects instantiated in the scene, just like in the hierarchy and when I click in the hierarchy, the corresponding object lights up in the game and vice versa (in runtime mode). Do you think it can be done? If so how? Thank you
     
  47. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    @Bonnye You can use an outline shader from Asset Store to highlight objects in the scene. To know when an object is selected, you can register to RuntimeHierarchy's OnSelectionChanged event from your C# script. You can also change the selection programmatically via RuntimeHierarchy's Select function for the vice-versa part.
     
    Bonnye likes this.
  48. FM1111

    FM1111

    Joined:
    Aug 30, 2023
    Posts:
    11
    Hello! Thank you very much for providing us with wonderful assets and making our work more efficient.
    I have a question about this asset, but it is displayed in the Unity inspector, but it becomes information overload, so can I narrow down the number of component properties in the runtime inspector?
     
  49. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
  50. FM1111

    FM1111

    Joined:
    Aug 30, 2023
    Posts:
    11
    Thank you for letting me know, yasirkula. I saw the explanation. Should I change the settings in Expose Fields?
    I don't know how to solve it because I don't have the ability. Can you give me some examples?