I use C++ to load a blueprint as UChildActorComponent,code as blow:
UBlueprint* BP1 = LoadObject(nullptr, TEXT(“/Game/Common/VisualReality/SteamVR/Blueprints/VRUI/UpStair”), nullptr);
UChildActorComponent* UpStair = CreateDefaultSubobject<UChildActorComponent>(TEXT("UpStair"));
UpStair->SetRelativeLocation(FVector(0, 0, 170));
UpStair->SetupAttachment(GetRootComponent());
if (BP1 != nullptr)
UpStair->SetChildActorClass(*BP1->GeneratedClass);
Show in BlueprintEditor:
But Show in Viewport:
hope somebody can tell me why or fix it! thanks!
Chinese Describle:
加载一个蓝图类作为UChildActorComponent,在Umap场景中显示出问题了,在BlueprintEditor中显示正确,而且如果直接拖拽一个蓝图类到BlueprintEditor,然后加到场景中是正确的!是加载的问题还是什么原因呢?