码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-10-20 11:38:49      阅读:2290      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!