Having a question about UPROPERTY. I do not have a very good grip on C++ yet so this might be a basic question.
The pawn tutorial mentions:
https://docs.unrealengine.com/latest/INT/Programming/Tutorials/PlayerInput/1/index.html
UPROPERTY()
USceneComponent* OurVisibleComponent;
It is written in the Pawn.h file. I would like to have the same functionality with the camera attached to the pawn, however that camera is created in the pawn.cpp like this:
// Create a camera and a visible object
UCameraComponent* OurCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("OurCamera"));
In order to get the functionality I attempted to clone what was done with
UPROPERTY()
USceneComponent* OurVisibleComponent;
And added:
UPROPERTY()
UCameraComponent* OurCamera;
in pawn.h
It appeared to compile, but the compile time went from 9 seconds to 100 seconds.
Now with my limited grasp on C++ so far,
- Why is the visible component being declared in .h and the camera in .cpp?
- Was defining the camera in the .h “bad” or breaking something because it added 90 seconds of compile time?