UE5遇到一个小白问题,在C++里面给Actor加了一个Mesh,然后一直报这个警告:
has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
查了一些资料,各种说法都有,最后发现:
WeaponMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("TurretMesh"));
WeaponMesh->SetupAttachment( RootComponent );
改成
WeaponMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("TurretMesh"));
SetRootComponent(WeaponMesh);
问题就解决了。