0

I'm following a tutorial for setting up a character interaction, and part of it says to make a header file with the following code:

public:

/*This property will be used in order to bind our subtitles
Binding will make sure to notify the UI if the content of the following
variable change.*/
UPROPERTY(BlueprintReadOnly)
FString SubtitleToDisplay;


/*Updates the displayed subtitles based on the given array*/
UFUNCTION(BlueprintCallable, Category = DialogSystem)
void UpdateSubtitles(TArray<FSubtitle> Subtitles);

/*This array will populate our buttons from within the show function*/
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
TArray<FString> Questions;

/*Adds the widget to our viewport and populates the buttons with the given questions*/
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = DialogSystem)
void Show();

Then, it tells me to "Implement an empty logic for the UpdateSubtitles function for now." I have no idea what this means, and considering that UpdateSubtitles was the one thing to give me an error when I compiled this code, it's probably something important. Does anyone know what this terminology refers to?

DualBall
  • 79
  • 2
  • 12
  • It's not a common phrase. My guess would be they mean to implement ( create a definition ) of the function, and leave the body empty. Also, I'd really suggest getting a C++ book, there's a good list [here](https://stackoverflow.com/a/388282). Unreal C++ is not exactly the same thing, but C++ knowledge is a good transferable skill to have ( especially for games ). It'll also just take the heartache away from learning unreal, and give a far more complete picture of the ways to go about solving problems in unreal. – George Jun 10 '20 at 07:11

2 Answers2

1

It means to just leave the contents of the function blank or return an empty result such as:

FString AMyCharacter::GetNickname()
{
    return "";
}

in the case where the return type isn't void.

  • Gotcha. So how would I go about resolving the issue in this case? My cpp file is blank other than an include for DialogUI (the name of this class), and I'm very new to c++ so idk how to go about creating a definition for this function. – DualBall Jun 10 '20 at 22:49
  • 1
    In this example you would have to add "void ClassName::UpdateSubtitles(TArray Subtitles){}" and do the same for Show() as that will throw an error too if you dont. – Hannah Crawford Jun 10 '20 at 23:26
0

I figured it out thanks to your comment! However it was a little different than what you described, it was actually:

void UDialogUI::UpdateSubtitles(TArray<FSubtitle> Subtitles) {}

And only this line; adding a definition for Show() as suggested actually threw an error.

DualBall
  • 79
  • 2
  • 12