Skip to content
Website logo
YawLighthouse

Unreal Engine Tip: How to get a UCLASS/USTRUCT's comment description.

Author:
Nicholas Helish

Nicholas Helish

Game Developer

You already read the About Me  page! I’m Nicholas Helish, the author for this article, website, cool stuff, and fan of cats!

March 04, 2026 · 3 min read

An Unreal Engine tip about Getting a Class/Struct's Comment Description.

In Unreal Engine when writing code you’ll usually write a comment or description for your classes/struct’s to help others reading that code understand what the intention is for that class/struct. You may have noticed the engine also features that same comment description in the editor in some places when selecting that class/struct as a tooltip or something.

If you’ve wondered how to receive that tooltip text for a tool or something, then you’ve come to the right place!

For simplicity’s sake I’m gonna give you an example struct and class with a comment description for them and then how you would get it that description. Then I’ll explain how it generally works internally in case you were wondering.

This only works in editor builds, this is not usable for shipped/cooked builds!

Our class and struct example
c++
/**
 * My cool comment for this child class type.
 */
UCLASS(...)
class MY_API UMyChildClass : UMyParentClass
{
    GENERATED_BODY()
    //...
}

/**
 * This struct is really cool, you wouldn't believe its utility!
 */
USTRUCT(...)
struct MY_API FMyStruct
{
    GENERATED_BODY()
    //...
}

The main function you’re looking for is UField::GetToolTipText so below are the examples using it.

Do not use UClass::GetDescription() since this just returns the friendly class name of the object where it strips Unreal specific prefixes.

In this example we’re using the parent class type, but you can use any class as long as it inherits from UObject.
c++
FString GetMyClassDescription(UMyParentClass* BaseObj)
{
    // NULL input check
    if (!BaseObj)
    {
        return FString();
    }
    UClass* baseClass = BaseObj->GetClass();
    // Returning the full description, if we inputted TRUE into the function 
    // then we would get the first sentence essentially of the description.
    return baseClass->GetToolTipText(false);
}

So in this case we’re using an instance, but you could also get away with using UMyChildClass::StaticClass()->GetToolTipText() because it primarily just needs the UClass.

For the struct example it’s along those same approaches but even shorter!
c++
FString GetMyStructDescription() const
{        
    // Returning the full description, if we inputted TRUE into the function 
    // then we would get the first sentence essentially of the description.
    return FMyStruct::StaticStruct()->GetToolTipText(false);
}

So since GetToolTipText exists on UField which both UClass’s and UScriptStruct’s inherit from, you can immediately access that data regardless.

Enum’s, functions, and properties operate in the same fashion where you just need the UEnum/UFunction/FPROPERTY/etc, and you’ll have that information because they inherit from UField.

Internally how this is achieved with two important aspects:

  1. Unreal Header Tool(UHT) processes the header files and takes the comment block above these types and stores it as metadata using the key ToolTip.
  2. For accessing that metadata you would call GetMetaData(TEXT("ToolTip)) on the UField type. This is literally what GetToolTipText uses internally anyway.
Share this post

Related Articles