Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[100% FREE][Released] Code Architecture Editor Extension

Discussion in 'Assets and Asset Store' started by stanislav-osipov, May 29, 2013.

  1. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello guys.
    I been working some time on this editor extension. But I need feedback, to make it better.
    I will appreciate any comments or answer on following questions.

    1) Did you find it useful for you?
    2) What would you like to see in future updates?

    Asset Store Link
    https://www.assetstore.unity3d.com/#/content/8765

    Overview

    This editor extension designed for the construction class diagrams of your project and code architecture visualization. You can see on screenshots below how it looks like.

    Package contains few empty example classes to showcase the expansion work. After you imported package, you can open new “My Architecture” window


    $edWindow.png

    After You open window you will see “Top Level” classes of you project. This is the class which doesn't have a parent (base) class.

    $MA2.png

    TOP Menu:
    1. State indicator. it will show the level at which you are. Or search line, if you in search mode.
    2. Search field. You can search you classes as well. Like in any other browser.
    3. Sort Method. You can sort your classes by childs count (recommended) or by size.
    4. Back Button. As soon as you leave top level. Back button will become active. So you can navigate your histroy

    Class view:

    $MA1.png

    1. Class Info. Here is some brief information of your class. Count of code lines, and count of childs
    2. Inside Button. Press the button and go inside class (You will see only class childs on this level)
    3. Open Button. Button will open class in your associated editor.
    4. Expand Button. Will chow class childs on current level. Expand button usage preview below

    $expand1.png

    Colors:
    Green - interface
    Yellow - abstract class
    Grey - public class

    Hope you enjoy using it :)
     
  2. Apshai-Arts

    Apshai-Arts

    Joined:
    Feb 3, 2013
    Posts:
    67
    Hmm... I can't see a single screenshot... But I know from first-hand experience that the forum has had some trouble with showing (uploaded attachment, for me) images.
     
  3. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    Fine idea and layout

    u will add notice about class? (based on comment before class in file or on simply text area) integrating open button with script inspector 2 (this is inside editor not external) or other extension (e.g. playmaker if it possible) ? adding foldout with list class members under class info?

    and i have ask: search can find named members? e.g. when i write Start() in search button then extension print ALL classes which have this method

    if I have more ideas i will write it ;)

    good work ! ;)
     
  4. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hm this is really strange.. I now about this forum trouble too, but I can see each screenshot now. Does any body has the same isuue?

    Breyer , thx fro your comment.

    this is defiantly wat I going to do in the next version.

    This is interesting but I do not want to force any body to write special format of comment.

    Yes this is possible. And I will do that, but a little bit later. (not in the up coming version)

    Hm.. I don't see how it can be useful.. Now search works only with class names, but add som search modes - this is good idea thx.

    Thx for helping me make this extension better :)
     
  5. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412

    it is small useful in fact but imagine: u have 100+ classes with 10+ members each and u need changing only 2-3 methods/property/fields and u forgot where they are ... normally u must look into docs but docs can be very HUGE and looking for him can take some times...

    new idea: when i search class then extension print this class in graph mode: parent/child/alone/parent&child?


    And location information (projects path to this class) and type language
     
    Last edited: May 30, 2013
  6. Apshai-Arts

    Apshai-Arts

    Joined:
    Feb 3, 2013
    Posts:
    67
    I can only see the screenshots in Chrome, not in Firefox... Weird...
     
  7. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,269
    Hi, nice, few things:
    - are you parsing the source files as text files and generating class/es info from this?
    I have one .cs file as a reference for myself which is completely commented out (meaning /* at the beginning of the file, */ at the end), but the class defined there is still shown in the MyArchitecture window (opening it from there still properly opens the file); moreover it's shown as a descendent of some nonexistent base class -)
    Using Mono's compiler/reflection would be probably more reliable for info like this, I don't know if its possible..

    - I'd exclude MyArchitecture.cs (and all files contained in plugin) when generating the view/tree ( empty example files too ) from the package.

    I've just quick tested it on a small project where it really wasn't of much use for me, but I will probably test it on bigger one which I'm not completely familiar with and will see if it helps in some way ;)
     
  8. Ecocide

    Ecocide

    Joined:
    Aug 4, 2011
    Posts:
    293
    I will definitely test this pretty soon. It's exactly what I need to get some overview in my project. Maybe you could use some typical UML notation in your further development.

    Thanks for this FREE offer. It's not to be taken for granted.
     
  9. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I'm Usign regular expressions for this. Using Mono's compiler/reflection was my firs idea, but It failed for many reasons. I will test whole commented class, it not spouse to be shown.

    Great, wait for your review ;)

    Let me now your impressions when you test it :)

    Thanks for kind worlds. It just not finished yet, it's only first version. And I can make it really good only with your feedback guys. When it will be completely finished I will put donate button or some price on a package. But for now I only want to make extension that is really can accelerate your development by saving some time, or event make your code architecture better.
     
  10. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,269
    Well.. the text parsing is not ideal for sure..
    e.g.
    -
    Code (csharp):
    1. public class StringTable: Dictionary<string, string>
    produces base class named 'able' with 1 child, open button giving 'File not found' (expanding works though)

    - I have base classes named 'string' with 2 children, and 'Dictionary' with 1 child with both expand and open buttons doing nothing / displaying error ( opening apparently does not work for Mono classes, which is not a problem.. )

    - I couldn't figure out how to get from search mode back to overview, after closing and reopening window it displayed just empty window

    - btw this was in 3.5.7 [although asset store reqiures 4.0]

    - it's rather quick; ( thought it will take longer to gather info :)

    - just noticed right now - the colors based on file size/line numbers is a nice touch..

    Cheers
     
    Last edited: Jun 2, 2013
  11. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,741
    Hey lacost, interesting extension! Congrats!!! :D

    Here's a code snippet to open a script in Script Inspector 2. It would automatically fallback to opening in the external editor if Si2 is not installed:
    Code (csharp):
    1.     // Takes MonoScript as parameter, but you can easily modify this to take asset path or GUID
    2.     public static void OpenScript(MonoScript scriptAsset)
    3.     {
    4.         // Check is Script Inspector 2 installed first...
    5.         // Should be in the same assembly as your CodeArchitectureHelper class (or any other C# Editor class)
    6.         var si2WindowType = typeof(CodeArchitectureHelper).Assembly.GetType("FGCodeWindow");
    7.         if (si2WindowType != null)
    8.         {
    9.             // It is! :)
    10.             var openAssetInTab = si2WindowType.GetMethod("OpenAssetInTab", new System.Type[] { typeof(string), typeof(int) });
    11.             if (openAssetInTab != null)
    12.             {
    13.                 string scriptPath = AssetDatabase.GetAssetPath(scriptAsset);
    14.                 if (!string.IsNullOrEmpty(scriptPath))
    15.                 {
    16.                     string guid = AssetDatabase.AssetPathToGUID(scriptPath);
    17.  
    18.                     // Must invoke through Reflection to avoid compile errors if Si2 is not installed...
    19.                     // You can also pass the desired line number (zero-based) instead of that last -1 ;)
    20.                     openAssetInTab.Invoke(null, new object[] { guid, -1 });
    21.                     return;
    22.                 }
    23.             }
    24.         }
    25.  
    26.         // Fallback to external editor
    27.         AssetDatabase.OpenAsset(scriptAsset);
    28.     }
    29.  
    Using regular expressions is not the best idea maybe... Sooner or later there will be a case where that method fails to process the source files correctly. You may be able to apply a patch for each individual case but there will be always something more and more, and you can't go like that forever... What was the reason to not use Reflection? The only reason I see might be that Reflection doesn't know anything about source files, so it can't tell you the source files used for some particular System.Type... There's a solution for that, Mono.Cecil library can read .mdb files and it can tell you the source files used to compile a class. Let me know if you need some help with that...
     
  12. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello guys. A planing to put new version on this weekends. It will contains fixes of all issues described in this topic + few new features, witch I will describe after release

    r618, thx for the comment. I will fix those in up coming update.

    Yes, you write, I forgot do describe it).
    les that 250 lines = green color
    more than 250 lines = yellow color
    more than 500 lines = red color, and you probably need to do something with your class, to make it simple.

    Flipbookee, Thx for the comment, Script Inspector 2 integration is defiantly will be in the next update.
     
  13. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
    Seems to be a great idea. I'm gonna test it when I have time.
     
  14. fano_linux

    fano_linux

    Joined:
    Jan 1, 2012
    Posts:
    909
    Last edited: Jun 3, 2013
  15. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Thank you :)

    This is what I'am afraid of :) But for now I see interest and a lot of people try to help me improve it. And i wiling to push some big update this weekends, with a lof of bug fixes and few new features. So if people who intreated in this extension will keep coming, I planing put a lot of work in it :)
     
  16. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
    I think the big difference between fano_linux's idea is that this one generates code from diagram. (am I right?)
     
  17. Apshai-Arts

    Apshai-Arts

    Joined:
    Feb 3, 2013
    Posts:
    67
    I think you should make those limits editable by the user. In some projects, 500 might be fine while in others 300 might be considered bloated.
     
  18. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    No, I'm not generation any code. It just build's your class diagram.

    Developing an extension I am following two main goals:

    1) Allow you to navigate your code much faster. In future you will be able to search not only files, but methods and parameters. You will be able to see where did your use specific class, variable or method.

    2) Allow you to see your code architecture graphically. Follow the extending hierarchy, see all class methods and variables without open it, etc.

    And I believe that it will be very useful and helpful tool.
    Despite the fact that only first version in public access, witch has only small part on planned functionality, I got a lot of support, reviews and ideas.
    So I am very positive about to continue the work on this tool.


    Apshai Arts, I defiantly will put some config in new version. And probably consider to make it visually edited in future.
     
    Last edited: Jun 16, 2013
  19. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
    I never thought about it, but it does not seem to be so hard to make it generate new classes too.
     
  20. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    This is not hard at all. But how you suggest to use this?

    For example I fond class MyAbstractObject in diagram and i wand to create new one to extend in.
    But where extension should create it? Open save dialog - this tooo long.

    Or did you mean something else?
     
  21. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
  22. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Version 1.1 is submitted on asset store
    You can also get package here

    Fixes

    * Commented classes does not appear in diagram any more
    * Code Architecture classes removed from diagram
    * Parser now use reflection for building correct view for classes like
    Code (csharp):
    1. public class StringTable: Dictionary<string, string>
    2.  
    * Editor styles impact fixed
    * Scroll bars auto size fixed
    * Small spelling fixes



    New Features

    * Full Class View mode (Methods View and Find Usage not implemented yet )
    * New colors for Light editor theme
    * Class Fileds view
    * Class Will be opened in Script Inspector2, if it's available.

    $fullView.png
     
    Last edited: Jun 9, 2013
  23. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    936
    Great idea, thanks for sharing!!!
     
  24. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,084
    This looks really nice and cool! Thanks for sharing.
    Does it work with JS as well? :D
     
  25. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    nuverian, kenshin thx for kind worlds.

    And no, it not working with JS :)
     
  26. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Version 1.2 is submitted on asset store
    You can also get package here

    if your diagram is big, the scrollbar works but loose the connections.

    Fixes
    • Diagram not losses connections any more when scrolling.
    • Color fixes for Unity Editor Light Color scheme.


    New Features

    • Class Fields view .


      $PMpreview.png
    • Search modes. You can search classes, methods and fileds now.

    $AMP1.png

    $SMP2.png
     
  27. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,818
    Hey, sorry for being slow, but I didn't get what exactly this does from reading the OP...
     
  28. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
  29. AnonnyMoose

    AnonnyMoose

    Joined:
    Nov 28, 2014
    Posts:
    30
    Hi, is this tool still being supported? It looks interesting, but when I run it it only shows your example classes plus some classes from some other add-ons I'm using, but none of my actual classes (all in C#)? I can't see anyway of pointing it in the right direction either?

    Thanks!
     
  30. Lanslot

    Lanslot

    Joined:
    Nov 18, 2016
    Posts:
    37
    Can you continue update?
    or can you open-source,we can do something modifies by ourselves.
     
  31. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    753
    did this tool move? can't reach the publisher's page either
    if yes, anyone knows an alternative?
     
  32. ttw1993

    ttw1993

    Joined:
    Jul 19, 2017
    Posts:
    11
    I want this too, if someone makes this plugin, I will buy it