Search Unity

RelationsInspector - reveal structures in your project [+demo]

Discussion in 'Assets and Asset Store' started by seldom, Jan 29, 2016.

  1. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    That's true. For tree data, nodes take up more visual space than a standard tree view. My asset's main focus are graphs though and I feel like a generic tree view should be a separate tool. Thank you for your feedback!
     
  2. gibber10

    gibber10

    Joined:
    Dec 18, 2016
    Posts:
    8
    I'm getting alot of errors in 2017.1 when I try the demo. Will the package be updated to work in 2017.1?

    I'm seeing the following error repeatedly.

    UnityException: GetBool is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'WelcomeWindow'.
    See "Script Serialization" page in the Unity Manual for further details.
    RelationsInspector.WelcomeWindow..cctor ()
     
  3. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Thank you for letting me know. I submitted an update to the store that fixes this issue. Until the update is published, you can use the attached package.
     

    Attached Files:

  4. gibber10

    gibber10

    Joined:
    Dec 18, 2016
    Posts:
    8
    Excellent thankyou. Its working and I'm learning how to use RI now.

    I have a question: Does RI allow you to insepect/edit the relations between objects that aren't MonoBehaviours or Scriptable Objects?
     
  5. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Yes, RI works with any class type. You will have to write your own backend code, however. For an example, check out the TypeInhertanceBackend that ships with RI. Let me know if you need help.
     
  6. gibber10

    gibber10

    Joined:
    Dec 18, 2016
    Posts:
    8
    Awsome, thats looks like exactly what i'm looking for.
     
  7. gibber10

    gibber10

    Joined:
    Dec 18, 2016
    Posts:
    8
    Hi,

    Is there a way to Open RI and tell it to graph the asset from an editor script?

    Code (CSharp):
    1. public class BehaviourTreeAssetEditor
    2. {
    3.     [OnOpenAssetAttribute]
    4.     public static bool Open(int instanceID, int line) {
    5.  
    6.         if (Selection.activeObject is BehaviourTreeAsset) {
    7.             Debug.Log("OpenRI");
    8.             return true;
    9.         }
    10.         return false;
    11.     }
     
  8. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Yes, the RI window has an API that lets you set its target objects and backend type, among other things. This should do the trick:

    Code (CSharp):
    1.     public class BehaviourTreeAssetEditor
    2.     {
    3.         [OnOpenAssetAttribute]
    4.         public static bool Open( int instanceID, int line )
    5.         {
    6.  
    7.             if ( Selection.activeObject is BehaviourTreeAsset )
    8.             {
    9.                 EditorWindow
    10.                     .GetWindow<RelationsInspector.RelationsInspectorWindow>()
    11.                     .GetAPI1
    12.                     .ResetTargets( new[] { Selection.activeObject }, typeof( YOUR_BACKEND_TYPE ) );
    13.                 return true;
    14.             }
    15.             return false;
    16.         }
    17.  
    18.     }
     
  9. mgonz

    mgonz

    Joined:
    Nov 17, 2012
    Posts:
    1
    Just purchased your tool! Can't wait to use it, but I'm getting this error:
    Assets/Editor/GraphBackends/InventoryPro/BackendUtility.cs(2,7): error CS0246: The type or namespace name `Devdog' could not be found. Are you missing an assembly reference?
    Please help, thanks.
     
  10. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Thank you for the purchase!
    Do you have Inventory Pro installed? If so, they must have changed their API since I wrote the plugin for InvPro. I'll look into it.
     
  11. mkgnzlz

    mkgnzlz

    Joined:
    Aug 13, 2010
    Posts:
    2
    No I did not have it installed! Duh. It was a late night. Thank you for your response. Nice tool.
     
  12. adventurefan

    adventurefan

    Joined:
    Jan 17, 2014
    Posts:
    230
    Hmm... trying the demo out on Playmaker... I like it so far except one thing. In Playmaker you can put as many FSMs as you want on a single object (helpful to group your FSMs), and they have different names or are just autonamed FSM, FSM 2, etc...

    I don't see RelationsInspector mentioning any actual FSM names though. It just mentions the game object name which leaves out some much desired info for me on what FSM is being referenced on an object. Could it be done to make it display the FSM name being referenced? I guess a workaround is make a dummy object for every FSM, but my older stuff isn't done like that.

    edit: this also seems to prevent clicking on the RelationsInspector map to go to FSMs correctly. It only takes you to the first FSM on whatever you click.
     
    Last edited: Nov 30, 2017
  13. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    I probably didn't consider the possibility of multiple FSMs per gameobject when I wrote the plugin for Playermaker. If their names are available in Playmaker's API, it should be easy to show them in the graph. I'll have a look. Selecting the correct FSM might be trickier. Thank you for the info!
     
    adventurefan likes this.
  14. Lanslot

    Lanslot

    Joined:
    Nov 18, 2016
    Posts:
    37
    how can it show class diagram?
     
  15. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Sorry, I missed your message.
    You can generate a type hierarchy graph. First you have to install the backend:
    * open RI through Window -> RelationsInspector
    * in RI's menu, open the Settings menu (the cogs icon on the right)
    * select Info + Addons
    * in the Addon window, scroll down to the Type hierarchy entry and select it
    * this installs the backend

    Now in RI's menu you can select this backend from the dropdown to activate it. Drag a C# code file from the project view in the RI window to generate the type graph for it.
     
  16. Lanslot

    Lanslot

    Joined:
    Nov 18, 2016
    Posts:
    37
    upload_2018-5-9_0-4-5.png
    how to do? still not show anything i want.
     
  17. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Sorry, my mistake. That backend requires some extra glue code.
    Overwrite Assets/Editor/GraphBackends/TypeHierarchy/TypeInheritanceBacked.cs with the attached file, then it should show the correct graph.
     

    Attached Files:

  18. Iain-Lobb

    Iain-Lobb

    Joined:
    Jan 11, 2013
    Posts:
    30
    I was trying to compile a project that uses DarkTonic Master Audio (which includes RelationsInpector) on Cloud Build. The build was always failing because Cloud Build cannot find RelationsInpsoector, e.g.
    Code (CSharp):
    1. [Unity] Assets/Plugins/Editor/RelationsInspector/BackendUtils/BackendUtil.cs(6,26): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `RelationsInspector'. Are you missing an assembly reference?
    2. 21: [Unity] Assets/Plugins/Editor/RelationsInspector/BackendUtils/DrawUtil.cs(3,26): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `RelationsInspector'. Are you missing an assembly reference?
    3. 22: [Unity] Assets/Plugins/Editor/RelationsInspector/BackendUtils/ScriptableObjectBackendToolbar.cs(3,26): error CS0234: The type or namespace name `Extensions' does not exist in the namespace `RelationsInspector'. Are you missing an assembly reference?
    For the future reference of anyone else getting this error - it was because SourceTree ignores .dll files by default. You can change this in sourcetree's options.
     
    Last edited: Feb 26, 2019
  19. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Thanks for the update!
     
  20. vamky

    vamky

    Joined:
    Aug 9, 2014
    Posts:
    70
    Hi

    I have bought this plugin backed in its very early days, and now it seems relationship inspector is not getting much updates. Is there any plan for it in the future? Or any plan to release the source code to those bought it so we can maintain and update it ourselves?
     
  21. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Hi vamky, thanks for buying RelationsInspector!
    The product is mature now and I have no plans for it beyond bugfix releases. A source code archive is included in the package, so you already have full control over RI. Or are you asking about a code release under an open source license?
     
  22. vamky

    vamky

    Joined:
    Aug 9, 2014
    Posts:
    70
    My bad, I didn't check folders properly, thanks!
     
  23. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Hey there, maybe you remember me, I was one of the first testers quite a while ago.
    I gave RI another try, it's great to see how it has progressed!
    First thing I noted, though, is that the Type hierarchy backend is broken - it throws exceptions in Unity 2019.2. I was able to restore it by excluding dynamic assemblies (as these don't support GetExportedTypes):

    Code (CSharp):
    1. List<Type> assemblyTypes = new List<Type>();
    2.             foreach(var asm in assemblies)
    3.             {
    4.                 if (asm == null) continue;
    5.                 if (asm.IsDynamic) continue;
    6.                 var ts = asm.GetExportedTypes();
    7.                 if(ts != null)
    8.                     foreach (var t in ts)
    9.                         if(t != null && t != inspectedType)
    10.                             assemblyTypes.Add(t);
    11.             }
    This, plus your hotfix file above, enabled the type hierarchy again.
    Do you have a reflection backend that is able to traverse over multiple types and show their relations?
     
    JaisyKo likes this.
  24. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    It's a shame you aren't going to update RelationsInspector anymore, there is still a lot of room for improvement. Useability wise, it could be a lot better:

    - No shortcut to quickly fold/expand nodes without accessing the context menu.
    - Cannot drag several selected nodes at once. Dragging should move every selected node together.
    - No keyboard shortcut (held toggle) to drag children nodes of the selection.
    - Zooming/layout for rectangle nodes is clunky with big graphs, for example the whole scene. You can't navigate and parse the graph efficiently with your eyes because the nodes are either all overlapping when zoomed out, or they are too far apart when zoomed in. If text size could scale along with zooming it would help, that way the graph could have a fixed appearance instead of warping and changing depending on the zoom.
    - Cannot drag nodes directly back to the inspector to link objects together. For example the user could hold a key on the keyboard and drag a scene object shown in RI into a script's field in the inspector.

    There is also the possibility of additional features. This might be a bit of a pipe dream, but it could potentially replace the hierarchy completely by providing features that let users work directly inside in RI. For example the user could press a key and drag to make connections between two nodes, which would translate to modifying a game object's parent.

    It would also be huge if scripts could be scanned to see which other objects in the scene they reference. HyperGraph in Hierarchy Pro does this essentially:

    upload_2019-10-1_15-53-40.png

    It can also show relations for UnityEvents. (which functions of which object are going to be called when the event is fired)

    With further improvements and features, this is the kind of plugin which could become as legendary as Odin Inspector. Think big!
     
    sirxeno likes this.
  25. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    @fherbst thank you, I will ad that fix! Sorry that I somehow didn't notice your reply. What do you mean by the reflection backend? Would you like to see something other than the inheritance relations?

    @oxysofts those are great suggestions, I think most can be implemented. Thank you! I myself do not have the time to work on RelationsInspector anymore. If you or anyone else would like to pick it up, I'm happy to release it under BSD/MIT or whatever license fits best.
     
  26. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    I may very well dabble on it in my free time. I'm not sure when but it's certainly on my mind for the future if you do open-source it. Something which shows events between all objects in the scene and lets you work directly in there would be a game changer.
     
  27. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    @seldom Hi, any update on open sourcing this code?
     
  28. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    @oxysofts Thanks for reminding me, here you go: https://github.com/seldomU/relationsinspector
    The readme is bare bones, it should probably have at least some build instructions. Let me know if I can help with anything.

    Now with the source being open, it's also free on the asset store (once it's reviewed) and the demo package is therefore deprecated.
     
    oxysofts and fherbst like this.
  29. GermiyanBey

    GermiyanBey

    Joined:
    Aug 18, 2017
    Posts:
    68
    I wanted to try RelationsInspector today, I installed Playmaker Addon too, is it me or is RelationsInspector not working Playmaker FSMs properly?
    I choose Playmaker FSM Graph type on upper bar, I drag an object to the window that has FSM with many external dependencies, it doesn't work (I mean, only the gameobject that holds the component appears). When I drag the FSM, it doesn't work again. But other dependencies of game objects or scripts are shown correctly in Tree or Graph views.
     
  30. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    @GermiyanBey Here is some documentation for the Playmaker addon. Once you selected the FSM graph type, there should be a show active scene button in RelationsInspectors menu bar, which creates the graph.
     
  31. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,235
    Wow, this thing is great. +100 for sharing it. Big thumbs up.
     
    laurentlavigne likes this.
  32. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    Thank you!
     
  33. sepnax

    sepnax

    Joined:
    Jun 24, 2014
    Posts:
    6
    Hey just found this asset by accident and found your work really intersting!
    I enthuastically decided to try it in our project and then ran into some problems.
    It seems that it's not finding any backends I create. Our project is quite big and divided to many assembly defines. Could this be the issue? Does it support assembly defines?
     
  34. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    @sepnax Are your backends in a separate assembly? I think I only ever worked with backends that are in an Editor folder, so it's possible that ReleationsInspector only looks there. The fact that your project contains many dlls should not be an issue.
     
  35. sepnax

    sepnax

    Joined:
    Jun 24, 2014
    Posts:
    6
    Yes I have many editor folders. All of them are in different Assembly Definitions.
    Is the code for fetching backends adjustable somewhere? I could look into myself as well.
     
  36. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    The code is on github. I looked it up and found the issue in backend loading code: it only puts the two default editor assemblies in the
    backendSearchAssemblies
    variable.
     
  37. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    This is great, @seldom ! Just what I was looking for.
    That's the thing when you use more ScriptableObejcts and less Singletons, how do you trace dependencies!
    Now before I attempt to make a custom backend, I was wondering, do you have a backend for UltEvent?
     
  38. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    118
    There is no backend for UltEvent, but if you want to have a go at it, the backend for Unity's event system could be a good starting point. And I'm happy to help if you have questions.
     
  39. cryptoforge

    cryptoforge

    Joined:
    Jan 21, 2015
    Posts:
    60
    Thanks for making this!
     
  40. cryptoforge

    cryptoforge

    Joined:
    Jan 21, 2015
    Posts:
    60
  41. thangnh111

    thangnh111

    Joined:
    Aug 4, 2020
    Posts:
    21
    In scene graph, can i make a rect below a gameobject that show all component of it?
    upload_2022-7-19_9-10-2.png
     
  42. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    76
    upload_2023-1-6_16-36-52.png
    upload_2023-1-6_16-38-20.png
    How to see reference line between Directional Light object and the Cube Object?
     
    StenCG likes this.
  43. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    It seems to be missing a Component References feature.