How to simply print something?

Hello, I’m new to UE and I’ve been primarily focused on learning and using C++ and I wanted to do something very simple (or I at least I think this is simple) use UE_LOG to print something. So in my head, it made the most sense to make a new empty c++ class because I’m not making a character or an actor not sure if that’s how it works though, but yeah so I made an empty one not sure where to go from here I tried a few things, but couldn’t get the print to work. Making other classes they seem to automatically generate a Tick and BeginPlay function and when I use UE_LOG in them it works so are these mandatory at all? Or how do you run code from an empty c++ class?

To run code from an instance of a class, you need to create an instance, and then call methods on it.
The Unreal base classes (Actors, etc) have a lot of built-in functionality that will cause the engine to call specific methods; when you’re writing your own classes that don’t directly integrate with the engine systems, you have to do your own manufacturing and calling, just like in any other C++ program.

There are already a bunch of classes that are necessary for your game to run so you can count on them to already have an instanced spawned in the world, meaning they are a good place to put “global” functionality:

  • Game Instance
  • Game Mode
  • Player Controller
  • Player Pawn or Character

You can access any of them through UGameplayStatics which has nice static funcions such as: GetGameInstance, GetGameMode, and so on.