AToonCarPawn::AToonCarPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
mySceneComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("OurVisibleComponent"));
}
But i get the error :a value of type “UStaticMeshComponent *” cannot be assigned to an entity of type “USceneComponent *”
Doesn’t UStaticMeshComponent inherit USceneComponent? Am I misunderstanding something? I am perplexed.
Just to clarify, that’s not ALL that’s in those files. I just included the relevant snippets, and didn’t realize it would put line numbers like that. Let me know if I’m leaving out anything important.
you must use the exact class type for every member that are flagged as UPROPERTY, otherwise the Blueprint magic won’t work.
This is inherent to the way UE4 macro work: UPROPERTY will parse the next line and generate blueprint access (read/write…) functions according to the class.
It looks like they do exactly this in the third step of the tutorial. Maybe I’m missing a setting somewhere or some nuance that’s allowing them to do this? Is there any difference between their code and mine that i’m not realizing?
I tried the exact code you have above and it compiled and runs fine.
This was as a member variable with parent class UActorComponent;
Perhaps it needs a clean + build so the generated file is recreated? The only other thing that comes to mind is it’s somehow picking up a override, perhaps with a default template parameter?
Mac10.11.2,Xcode7.2,Unreal 4.10.2