Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    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:
    111
    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:
    111
    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:
    111
    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:
    111
    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:
    111
    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:
    199
    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:
    111
    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:
    111
    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:
    111
    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:
    111
    Thanks for the update!
     
  20. vamky

    vamky

    Joined:
    Aug 9, 2014
    Posts:
    69
    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:
    111
    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:
    69
    My bad, I didn't check folders properly, thanks!
     
  23. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    409
    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?
     
  24. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    34
    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:
    111
    @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:
    34
    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.