首页 > 其他 > 详细

UE4 中在 Actor 中动态 Create Component 与ChildActor 的 小笔记

时间:2016-10-20 11:38:42      阅读:2306      评论:0      收藏:0      [点我收藏+]

创建Component:

UCpp_MyComponent* temp_imageCom = NewObject<UCpp_MyComponent>(this, UCpp_MyComponent::StaticClass());
temp_imageCom->RegisterComponent();
temp_imageCom->AttachToComponent(pParentComponent, FAttachmentTransformRules::KeepRelativeTransform);

 

创建Actor Component:

仅多了一步SetChildActorClass

auto temp_childActorComponent = NewObject<UChildActorComponent>(this, UChildActorComponent::StaticClass());
temp_imageCom->RegisterComponent();
temp_childActorComponent->SetChildActorClass(*MyActorClass);
temp_imageCom->AttachToComponent(pParentComponent, FAttachmentTransformRules::KeepRelativeTransform);

 

UE4 中在 Actor 中动态 Create Component 与ChildActor 的 小笔记

原文:http://www.cnblogs.com/linqing/p/5979939.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!