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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Hierarchical Class Documentation

Discussion in 'Documentation' started by packetbuddha, Dec 28, 2016.

  1. packetbuddha

    packetbuddha

    Joined:
    Dec 27, 2016
    Posts:
    1
    I'm new to Unity and C#. I'm finding it somewhat difficult to wrap my head around what inherits from what and when to use one thing over another. That said, I'm trying to find a hierarchical view of the available classes so as to more easily understand Unity class inheritance. Something like this - but for current versions (>= 5.5):

    https://docs.unity3d.com/412/Documentation/ScriptReference/20_class_hierarchy.html

    I was not able to find it in the current 5.5 manual, nor under the scripting API portal.

    Thanks in advance.
     
    AntonioModer likes this.
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Hi PacketBuddha... The 5.5+ class hierarchy document would look very very similar to that for 4.2.1. I forget the reason why 5.x didn't show this information, but I'd expect it's accidental rather than deliberate. However, the amount of classes in Unity have escalated massively, so the Runtime Classes would be huge as a page of classes. The 4.2.1 doc shows, as most important:

    Object->Component->Behaviour->MonoBehaviour

    as you can see. This is perhaps the only critical information to know. As you are creating scripts for your game using MonoBehaviours is most important. Maybe explain what you are trying to implement and am sure forum users will chip in. (Could be better in a different forum, though.)

    I know this is only a short reply. I'll ask the doc team to consider making the 5.x version.
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,201
    Other important ones are:

    Object->ScriptableObject
    Object->GameObject
    Object->Component->Rigidbody/Transform/Collider/AudioSource/etc.etc.

    Both Visual Studio and (I believe) MonoDevelop allow you to see this information. Either right click a class name and select "Go to implementation", or just put your caret over it and press f12. You'll see the signature of the class and all it's public methods, which helps a lot in understanding what it's about.
     
  4. feiting

    feiting

    Joined:
    Oct 26, 2012
    Posts:
    33
    Neither was I, so I spent a couple hours and made this awhile ago: https://forum.unity3d.com/threads/i...1.2059737815.1496771707-2001328212.1485958668 It should help for understanding. Unfortunately, I felt like erasing the redundant info about functions inherited wasn't worth the effort, but since this seems to be an ongoing desire, maybe I'll do this again as a community thing.

    Their scripts are auto-generated via a script, so hierarchies may or may not be easy for them.
    In another post, I fixed the manual to respond to arrows and move that right one next to the left arrow (impossible to reach easily when browsing on wide screens), for Firefox, and someone else helped me with other browsers.

    Unity barely had anyone working on docs until a year or so ago, so I don't blame them. But I do prefer hierarchical docs like apple
     
    Rudranil95y likes this.