UE4 c++添加Component

目前知道的主要有两种方式

一种是只能在构造函数中

	UStaticMeshComponent* com = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("test"));
	com->SetupAttachment(RootComponent);

另一种是Runtime添加

com = NewObject<UStaticMeshComponent>(this, TEXT("ffff"));
	AddInstanceComponent(com);
发布了144 篇原创文章 · 获赞 15 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/maxiaosheng521/article/details/94023321