Fish-1028
(Fish-1028)
1
Hi all!
I want to know that how to call constructor function in ACinemaCameraActor.
-----------------------------------------.h-----------------------------------------------------
UCLASS()
class MyAPI AMyCineCameraActor : public ACineCameraActor
{
GENERATED_BODY()
public:
AMyCineCameraActor();
-----------------------------------------.cpp-----------------------------------------------------
AMyCineCameraActor::AMyCineCameraActor() "{ "<=== here error
PrimaryActorTick.bCanEverTick = true;
}
Error message : No default constructor exists.
Thank you.
Fish-1028
(Fish-1028)
2
Thank you!
Is That means we don’t have to include constructor in headers?
dZh0
(dZh0)
3
Constructor is automatically called every time an instance (an object) of that class is created.
This constructor should work:
AMyCineCameraActor::AMyCineCameraActor()
{
PrimaryActorTick.bCanEverTick = true;
}
Happy coding 
dZh0
(dZh0)
4
The declaration of the constructor MUST remain in the header.
*.h file
// ...
public:
AMyCineCameraActor();
// ...
*.cpp
//...
AMyCineCameraActor::AMyCineCameraActor()
{
PrimaryActorTick.bCanEverTick = true;
}
//...
This code will be called every time you spawn an object from this class or place it in the editor.
Since it seems that you are new to C++ here is an article about the header files and what should they contain.