I use “MainCamera->SetupAttachment(RootComponent);” to attach a camera to one pawn in its constructor. But when I run the game the output log shows the error below:
Does it means that I need to initialize the RootComponent first?
I use “MainCamera->SetupAttachment(RootComponent);” to attach a camera to one pawn in its constructor. But when I run the game the output log shows the error below:
Hey @justinpopo1 ,
Could you show the constructor code to help track the problem?
Maybe your pawn doesn’t have anything setted to rootcomponent?
I’ve solved this problem. You’re right. I use “RootComponent=MainCamera” and the error disappears. But as far as I know, an Actor has a Default Scene RootComponent. Why we still have to set it by ourselves.
Yes it has a default scene root. Since the root is used for the actor transform, maybe they want us to replace the default one to make sure it’s work as expected. But I also not really sure about that.