Hi, How can I do it in Unreal to declare one comment for many variables instead of writing repeating the comment for every variable when they are in one category?
//@{
/** same comment for all variables*/
Float MyFloat;
Int MyInt;
FString MyString;
//@}
well you can write whatever you want in the comments, but the editor will only consume the comment immediately preceeding the variable and use it as a tooltip.
I assumed you wanted to repeat the same tooltip for each variable, which, no. Bad style practice.
#define SOMEMACROCOMMENT "This is a tooltip"
UPROPERTY(meta = (ToolTip = SOMEMACROCOMMENT))
float MyProperty = 1.f;
But I have never been in a situation I’d need a reusable comment. That might point at a bad code style. Also structs should just be used as data container for “any” purpose, as generic as the code allows. So it’s hard to add a single comment / tooltip to a struct.
this will only works for global variables defined in .h class , and what about variable s defined under the function definition? or local variables in .cpp file
You are way overthinking something. There’s no point to uproperty inside a function, it wouldn’t do anything useful. The only special handling of comments is to put them in as tooltips in the editor, which only occurs on things declared in class and struct templates.
Sorry, now I got you. Doxygen is a documentation generator and is confusing in the question the code you included is from doxygen . What you have asked, popup comments from another line, is impossible. The editor in VS shows only variable declarations and upper line comments.