I have an interaction function created in a C++ class and currently, when there’s nothing to interact with, it prints to the output log saying “nothing to interact with.” I’d like to have this appear on the UI I created for the player. I don’t want to create a gui using C++, I just want to call a specific one to appear inside of a C++ function. All the documentation and tutorials I found only show how to create an entire user interface using code. I’ve been finding it very difficult to find tutorials on how to mix blueprints and C++.
Thanks in advance!
Edit: I’ve searched through a lot of documentation and I think I need to use a CreateWidget constructor but I’m not sure how.
// Directly via the engine
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Message"));
or
// Via PlayerController. Many different ways to do this. You should check for null references before using
PlayerController* pc = GetWorld()->GetFirstLocalPlayerFromController()->GetPlayerController();
// You should check for null references before using
pc->ClientMessage(TEXT("Message"));
Blueprints are C++ objects as well. I’m sure many will disagree, but I really use Blueprints only for customising member instance data. E.g. a very simple example would be a character that wears a hat. Implement the character logic & data containers (like the hat mesh) in C++ by extending the Character class, then create different BP classes that extends your C++ character class and assign different hats as required.
But these seem like ways to just make text appear. I’ve already created the widget blueprint and the animation to fade it in and out. All I need to do it add and remove it from the viewport at a specific time.