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

Generate class diagram from code

Discussion in 'Scripting' started by TheEclipze, Jun 10, 2016.

  1. TheEclipze

    TheEclipze

    Joined:
    Jul 22, 2012
    Posts:
    11
    Hello!
    For some time now i've been looking for a good way of visually representing my C# classes dependencies and relationships to eachother but not really finding any tool that does the trick for me.

    I have tried with Visual Studio but the best it seems to be able to do is class diagram based on inheritance, and since most of my classes just inherit MonoBehaviour, this doesn't give much information.

    So basically what im looking for is a way of generating, from existing code, a Class Diagram that reflects the relationship between my classes. For example:

    Class A has a reference to and utilizes methods in Class B, so changing Class B could potentially alter the behaviour of Class A, visualizing this would help greatly in larger projects and especially if introducing new people to the project.
     
    MaxFrax96 and akuno like this.
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,181
    I've looked for similar things with no luck before myself. Doxygen is supposed to have some kind of diagrams, but I've never been able to coax it to make anything useful.
     
    gillemp likes this.
  3. TheEclipze

    TheEclipze

    Joined:
    Jul 22, 2012
    Posts:
    11
    I've also tried Doxygen, but it only generates inheritance diagrams for me, even when using Graphviz which should have the diagrams im looking for.
     
  4. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
  5. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    NClass is open source. You might be able to modify it to do this.
     
    malikcgcs likes this.
  6. TheEclipze

    TheEclipze

    Joined:
    Jul 22, 2012
    Posts:
    11
    I've looked into NCLass before but from my understanding that is more for making class diagrams ahead of time rather than generating them from existing code.

    As for the tool exiguous linked, I'll check it out
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    NClass is the only free one I know of (other than Code Architecture that exiguous linked, and Visual Studio for indies). It has a plugin that can generate UML from .NET assemblies. There are commercial solutions, though, like Altnova and VP.
     
  8. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    I followed this tutorial for Doxygen and I got it working! And this might help as well.
     
    naveenmcv1 likes this.
  9. ttw1993

    ttw1993

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