ProxSphere = CreateDefaultSubobject<USphereComponent>(TEXT("ProxSphere"), false);
Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"), false);
// make the root object the Mesh
RootComponent = Mesh;
ProxSphere->AttachToComponent( Mesh, FAttachmentTransformRules::KeepRelativeTransform );老方法里面是AttachTo就可以,但现在会提出警告
Unreal 给Actor添加Component
最新推荐文章于 2025-02-03 10:33:25 发布
本文介绍了使用Unreal Engine 4 (UE4)进行游戏开发时,如何创建默认子对象并将其正确附着到静态网格组件上。文章通过具体代码示例展示了如何创建球体组件与静态网格组件,并说明了在新版本中推荐使用FAttachmentTransformRules::KeepRelativeTransform来保持相对变换。
779

被折叠的 条评论
为什么被折叠?



