Why initialize variables in the header and not the constructor?

I was wondering why Ben initializes variables in the header file instead of doing it in the constructor? Is it because it’s visually easier to follow along that way? Or am I missing something?

Hey Martin, sorry for the delay. You need that if you want to be able to work with those variables in different functions. Also, you can add the UPROPERTY before a variable you will “edit” in the engine. For example, the variable PressurePlate, which you will set in the engine adding the “Trigger Volume”. Remember? Hope is helpful!

Privacy & Terms