Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. We are looking for your feedback about Templates! Tell us about your experiences by taking our survey.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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:
    117
    Graph editors are great for many things: state machines, shaders, animation transitions and visual scripting. These are universally usefull, but every project also has it's own structures that ideally had a graph editor, be it tech trees, crafting systems, dialog data, level progression or custom state machines. The problem is: writing such editors takes a lot of effort.

    The RelationsInspector (RI) editor window makes that dramatically easier. You can make a basic custom graph inspector by adding just two attributes to your code. You simply specify what's unique about your usecase: the kind of object relation you want displayed. RI takes care of the rest... it builds a graph, finds a layout and lets you navigate and modify it. Think of it as writing a custom inspector for your graph viewer. While RI saves you all that effort, you stil have the option to customize it: node widget UI, context menus, toolbar and much more.



    collage.png

    Use RI for the connections between objects and Unity's inspector for the properties of single objects. Both together are a great match.

    RI comes with an API, so your own tools can take full control over it. They can specify the data to display and the custom inspector to use and even modify the shown graph. If you develop an editor extension for the asset store, a custom graph inspector could be a great enhancement to your tool!

    Key points
    Asset store download
     
    Last edited: Sep 13, 2020
    OussamaB and Kropti67 like this.
  2. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Last night the demo landed on the asset store. It comes with all features of the full version. Check it out!

    Next up: more example use cases.. I'm thinking a simple dialog system and maybe something with Unity's new Playable API. That seems to lend itself nicely to node-based editing.
     
    dfury and theANMATOR2b like this.
  3. dfury

    dfury

    Joined:
    Jun 26, 2015
    Posts:
    1
    Good idea and I love the fact that it has a demo. I'll be sure to check it out.
     
  4. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Thanks, I'm glad you like it. I'll keep maintaining the demo along with the full version. That way, other tools can offer the RI as an optional view for their data, and their users get to evaluate it at no cost.
    Right now there is a "featured" box around RI's entry on the asset store. I haven't yet figured out what that means, but I assume the store team likes the tool. So thanks for that!
     
    Kropti67 likes this.
  5. Kropti67

    Kropti67

    Joined:
    Mar 4, 2015
    Posts:
    4
    Thanks a lot for the demo. Very useful! Iam not sure tho I want to see the mess i created.
     
  6. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    The dialog system example is ready. In addition to the node-based editor, the dialog data also uses Unity events, so you can hook any code to your dialog buttons. Check it out.
     
  7. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    I'm playing with a view for crafting links in Inventory Pro, so far it looks like this:

    invProBlueprints.png
     
  8. iamsam

    iamsam

    Joined:
    Dec 22, 2013
    Posts:
    233
    Excellent plugin! Looking forward to updates. Quick question, I could not find a way to track a script across multiple scenes, it only seems to work for prefabs. Is this functionality possible, if not do you think this would be included in a future update :). Thanks.
     
  9. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Do you want to see all scenes that reference a certain script? That should work. Just drag the script file from the project window into the RelationsInspector window and use the asset reference backend. You'll see the reference chains from your script into all the scenes that depend on it.
     
  10. iamsam

    iamsam

    Joined:
    Dec 22, 2013
    Posts:
    233
    Hey, That was exactly what I was looking for. It was my fault, I did not see your first post and thought that these were missing from the build. Is there a reason for them being hosted on github, will they be included in future builds? Thanks again for creating this plugin, it works like a charm for large projects and makes project management incredibly easy and fun :).
     
  11. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Awesome :)
    I didn't include the asset reference backend in the package because of the two problems listed in its readme. People should be aware of them before they use it. Maybe I'll include it in a future version and show a disclaimer dialog when you open it for the first time.
     
  12. iamsam

    iamsam

    Joined:
    Dec 22, 2013
    Posts:
    233
    @seldom I now understand why you did not include them.

    It is scary when Unity does not respond for a while, is it possible to include progress bars?

    Also it did not work in my project as it is a medium size project with several dependencies and each time I run the asset reference it crashes Unity.

    I tried running it in a small test project with a couple of scenes and it worked fine (even then it took a long time and somehow it did not show me scene names, might be a bug). What I did was attach an SMAA script to the camera on two different scenes and then tried to find the dependencies of this script. Doing this it did find that camera object, however the scene names were shown as blank squares.

    Hope you have a way to optimize the algorithm as this is a necessary feature and would help a lot with project management.
     
  13. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    I told you they aren't in the package for a reason :)
    The asset reference backend has to load scene files. Those calls block the main thread, no chance for a progress bar. It's the same as when you load a scene manually, the editor is unresponsive until that is done. It shouldn't crash though.. any chance you can share the project with me for debugging?

    I'll have a look at the scene name labels.

    The main performance bottleneck for that backend is the scene loading, which I have no control over. I doubt it can get much faster. But even with its flaws, asset reference analysis is still my favourite application of RelationsInspector.

    edit: The scene name label issue should be fixed now.
     
    Last edited: Feb 15, 2016
  14. iamsam

    iamsam

    Joined:
    Dec 22, 2013
    Posts:
    233
    Thanks for the info.

    I believe you should look at collaborating with the authors of Maintainer (http://forum.unity3d.com/threads/maintainer.309241/) and Asset Hunter (http://forum.unity3d.com/threads/1-3-6-asset-hunter-removes-unused-assets-from-project.274173/) as they seem to do similar searches across project scenes (although the latter is related more to scenes in the build). I have used Maintainer and it is fast and provides good results, the author is active and always open to suggestions (the same applies for the author of Asset Hunter). I think RelationsInspector can provide a very strong visual aid to these products.
     
  15. iamsam

    iamsam

    Joined:
    Dec 22, 2013
    Posts:
    233
    Thanks for the quick update, the scene name labels are displayed correctly now :).

    Do you do garbage collection or in some way monitor the memory involved in looking through the dependencies. I monitored my RAM while running the simple test described above (testing SMAA on cameras in two scenes). What I noticed was that the RAM it required to load the scenes and find the dependencies remained at that value even after the plugin had finished finding the assets and displaying them (For example the test above took approx 500 mb of RAM use and when the test finished that RAM was still being used and never freed, the high amount of RAM may have been due to one scene which is a bit heavy)
     
  16. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Interesting.
    The garbage collector is not invoked explicitly, but all scene objects are destroyed after it was analyzed and before the next one is loaded. Maybe something leaks, I'll do some memory profiling.

    Edit: I'm traveling this week, so it's going to be a few days until I have an update.
     
    Last edited: Feb 16, 2016
  17. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    I just finished a new RelationsInspection backend!
    It shows an overview of all UI event related data, lets you navigate to the involved objects and the listener's source code file.

    It looks like this:


    In action:


    @iamsam I did some profiling on the AssetReferenceBackend and got the same results as you. Sometimes Unity would release the memory after building the graph, sometimes it would keep it allocated. Now I'm enforcing garbage collection after scenes are unloaded and it looks better. As a precaution, the backend now also creates a fresh scene before doing anything (and lets the user save her active scene).
     
    iamsam likes this.
  18. iamsam

    iamsam

    Joined:
    Dec 22, 2013
    Posts:
    233
    @seldom Thanks for looking into it, looking forward to the update.

    UIEventBackend looks great, will try it as soon as I get some time from my current project :).
     
  19. ericbegue

    ericbegue

    Joined:
    May 31, 2013
    Posts:
    1,294
    Great tool to visually explore the data in your project. It provides you with another point of view on your project.

    I like the way it's integrated within unity. For example selecting elements in the Relations window also select them in the scene hierarchy.

    The Asset Dependency Backend is a great tool to explore the connections of your assets. I always wish such a similar feature to builtin in Unity.
     
    Last edited: Mar 4, 2016
  20. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Thank you, I was missing that in Unity as well :)

    I'm happy to announce: the first integrations with other Assets are now ready!
    • In S-Quest you use RelationsInspector to view and edit the dependencies between quests.
    • Master Audio uses RelationsInspector for a birds-eye view on sound events.

    The next update of RelationsInspector will simplify the installation of integration-backends like these.

     
    iamsam likes this.
  21. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Here are two more asset integrations I'm working on for the next update.

    Core GameKit Killable events
    The graph shows what unit types get spawned when a unit gets damaged, killed, deals damage, etc..



    Inventory Master crafting
    The graph shows crafting blueprint relations between inventory items.
     
    Rodolfo-Rubens likes this.
  22. ericbegue

    ericbegue

    Joined:
    May 31, 2013
    Posts:
    1,294
    hmm! Bloody hamburger. yumi!
     
  23. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    I hope that's tomato, not blood :)

    Today I got started on a graph for PlayMaker, showing the events sent between state machines.
    So far it looks like this:
     
    ericbegue likes this.
  24. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    286
    Hello!!

    I'm trying to figure out a way to "just" show some data objects, which only live on a single GOs Component. I have a component, DialogManager, which has an Array of Dialogs, each of which hold a reference to a Line object. Here is some example code.

    Code (csharp):
    1.  
    2. public class DialogManager : MonoBehaviour {
    3.     public Dialog[] dialogs;
    4. }
    5.  
    6. Public class Dialog {
    7.     public string name;
    8.     public Line[] lines;
    9. }
    10.  
    11.  
    12. Public class Line{
    13.     public string line;
    14. }
    15.  
    I added the "AutoBacked" and "Related" tags to the DialogManger & its dialogs array, but that didn't work. Will i need to implement a specific backend for this to show up in the RI's editor? Any pointers or hints appreciated!

    Jos
     
  25. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Hi Jos,

    AutoBackend is for types that contain references to themselves, like if your Dialog type would have a Dialog[] field.

    In your case you'll need a simple backend class. What exactly should the graph look like? Root nodes for the dialog objects, connected to nodes for their lines?


    Code (CSharp):
    1. using UnityEngine;
    2. using RelationsInspector;
    3. using RelationsInspector.Backend;
    4. using System.Collections.Generic;
    5. using System.Linq;
    6.  
    7. public class DialogManagerBackend : MinimalBackend<object,string>
    8. {
    9.     public override IEnumerable<object> Init( object target )
    10.     {
    11.         var asGameObject = target as GameObject;
    12.         if ( asGameObject != null )
    13.         {
    14.             var dialogManager = asGameObject.GetComponent<DialogManager>();
    15.             if ( dialogManager != null && dialogManager.dialogs != null )
    16.             {
    17.                 return dialogManager.dialogs;
    18.             }
    19.         }
    20.  
    21.         return Enumerable.Empty<object>();
    22.     }
    23.  
    24.     public override IEnumerable<Relation<object, string>> GetRelations( object entity )
    25.     {
    26.         var asDialog = entity as Dialog;
    27.         if ( asDialog != null )
    28.         {
    29.             foreach ( var line in asDialog.lines )
    30.                 yield return new Relation<object, string>( entity, line, string.Empty );
    31.         }
    32.     }
    33.  
    34.     public override GUIContent GetContent( object entity )
    35.     {
    36.         var asDialog = entity as Dialog;
    37.         if ( asDialog != null )
    38.             return new GUIContent( asDialog.name );
    39.  
    40.         var asLine = entity as Line;
    41.         if ( asLine != null )
    42.             return new GUIContent( asLine.line );
    43.  
    44.         return base.GetContent( entity );
    45.     }
    46. }
     
    Last edited: Apr 1, 2016
  26. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    286
    Ah, that is great! Thanks, that is more then enough for me to get started.

    Jos
     
  27. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    You're welcome!

    Version 1.1.1 landed on the store today, the changes are:
    • graph and tree layout improvements
    • added a Welcome window, where these add-ons can be installed
      • Inventory Master: a view of crafting relations and blueprints
      • S-Quest: a view and editor of quest dependencies
      • Asset reference and dependency: shows if and how a scene references an asset and what assets an object depends on
      • uGUI events: a view of the scene's UGUI event components and their handlers
      • Project view: a view of the project's asset tree
      • Type hierarchy: a view of a type's sub- and supertypes
    Two other tools integrate RelationsInspector since their last update: Master Audio and Inventory Pro.

     
    Kropti67 likes this.
  28. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    The PlayMaker inter-FSM graph is now ready for testing. Any feedback is apreciated, either here or on the PlayMaker forums.

     

    Attached Files:

    imaginationrabbit and Kropti67 like this.
  29. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
  30. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Version 1.1.2 is now on the store. For a few days it's 50% Off!.
    The changes are:
     
  31. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    320
    What is the difference between the demo and the full version?
     
  32. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    The full version includes an archive with the source code. The demo comes as a dll only. It also occasionally opens a popup window, asking the user to buy the full version.
     
    vicenterusso likes this.
  33. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    534
    Hi, this asset looks awesome. I want to take advantage of the discount and will buy it soon to support development, but have some questions:

    1. Is the demo compatible with the 5.4 beta? I seem to be getting some console warnings and errors when importing into an empty project.

    2. My use case would be for developing my own tech tree system and dialog system and seeing/editing it visually. In the first post you mentioned examples are included, but I'm not seeing any in the demo. Are they only available in the full version? Do you have simple examples of those types of systems?

    3. Let's say I create a tech tree system and inspect and edit it through RelationsInspector, and then I want to serialize the data to JSON using Unity's JSON utility so that it can be modded. If I import the data into a scriptable object at runtime, can it be inspected at runtime in the editor through RelationsInspector?

    4. In your Asset Store descriptions, you might want to include some words like tech tree, crafting system, etc. to have it show up in more search results.

    Thanks.
     
  34. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Hi @Korindian, thanks for your interest. About your questions:

    I'm getting a clean console in 5.4 beta 17 when I install the RelationsInspector demo. What are the errors you are getting?

    The two classes in Assets/Plugins/Editor/RelationsInspector/Backends/HierarchyExample can serve as examples. You can install more backends through the RelationsInspector window: in the gears menu, select Info + Addons. In particular, check out the backend for S-Quest. It shows how to add/remove graph nodes and edges. Then there's the documentation, and you contact me directly via PM or email.

    Yes, the tool is agnostic about where the data comes from. You tell it to use a runtime object as target, and that's it. If you want to, you could also display and edit your JSON data through RI. It's not restricted to unity object types.

    Thanks for the tip, I'll check my keywords.
     
    Last edited: May 18, 2016
    Tinjaw and Korindian like this.
  35. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    286
    Hey, is there a way, in the tree view, to enforce the way the layout works? I'm working on Behaviour Tree code, and would love to have it visualized using RI. An issue is that in BTs, the order in which child nodes are positioned matters. Looking at the API i don't see a way to influence the layout. Any suggestions?
    Thanks!
     
  36. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Yes, that's straightforward: the backend API's GetRelations method asks you for a node's children. The order in which you return them determines the order in which they appear in the tree view.

    If you want to go further and allow the user to edit the order through RI, I'd do it this way:
    • add "move up/down" context menu items to the node
    • in the item's event handler, change the order in your tree and call the RI API's Rebuild method
     
  37. gameboy

    gameboy

    Joined:
    Mar 25, 2009
    Posts:
    36
    Can RelationshipInspector work with Scripts that are not derived from MonoBehaviour or ScriptableObject (i.e. "standalone" C# scripts)?
     
  38. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Yes, graphs can be generated from objects of any type, Unity objects don't get special treatment in that regard.
     
  39. Extrakun

    Extrakun

    Joined:
    Apr 2, 2009
    Posts:
    69
    Hi, I am greatly interested in this package. I got one question - Is there anyway to display the graph inside the game at runtime, instead of just inside the inspector view?
     
  40. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Hi Extrakun. You can generate graphs from runtime game data, but only display them as an editor window.. not in the game view. That would require you to rewrite a good chunk of the code.
     
  41. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Is it possible to show or edit the relationship in json file ?
     
  42. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    @yuewahchan: Yes, you can view and edit json. You are in charge of serialization through. For example, you could read the inspected json file in the backend's Init method, and overwrite it in the edit-event handlers.
     
  43. brunoleos

    brunoleos

    Joined:
    May 14, 2014
    Posts:
    30
    Hi @seldom, congratulations for the tool.

    I sent you my occurrences in a conversation in the forum. Basically, the references backend is not working as expected for me, probably because of version 5.4. And uGUI events yields an error at the console.

    Please consider them, your tool is promising
     
  44. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Hi @brunoleos, thank you for your feedback.
    The attached backend updates should fix the problems you found. Extending the asset reference graph so that it includes event handlers is going to take a little longer, but it's a great idea. I wish I had thought of that :)
     

    Attached Files:

  45. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    I have a few vouchers for the full version to give away. If you want one, just let me know.
     
  46. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,042
    Hi, I'm just getting back into Unity after a javascript/Mean break. Could I have one? ty!
     
  47. mensch-mueller

    mensch-mueller

    Joined:
    Nov 25, 2014
    Posts:
    156
    Hi,
    I missed the last reduced price for your asset. It would be great to get a voucher.

    Thanks and have a great christmas!
    Michael
     
  48. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    Done and done. Happy holidays to you too!
     
  49. seldom

    seldom

    Joined:
    Dec 4, 2013
    Posts:
    117
    All the vouchers are taken now, but there's still the free feature-complete demo for anyone who wants to check out RelationsInspector.
     
  50. c0ffeeartc

    c0ffeeartc

    Joined:
    Jul 23, 2015
    Posts:
    37
    Hello,
    I've tried asset and like it.

    I have a suggestion: additional classic tree view without graph nodes.
    Nodes are great but not compact, and in some Graph Types nodes don't bring practical advantages.
    Representation similar to Unity's Scene Hierarchy would be perfect - triangular Expand Toggle at left, Icon and Name.
     
    Last edited: Feb 6, 2017
unityunity