目录
UE4 C++编程官方文档示例代码“缺省”补充
(边学边更新)
本来是想做勘误,但发现示例代码的问题大部分都是缺头文件(这应该和现在自建的类包含的都是CoreMinimal.h,而示例代码都是自建类包含Engine.h时期写的)以及少数函数版本过时的问题,所以本博客可就总结一些常用类对应的头文件和过期函数的替代。
常用类的头文件
UCameraComponent
“Camera/CameraComponent.h”
USpringArmComponent
“GameFrameWork/SpringArmComponent.h”
USphereComponent
“Components/SphereComponent.h”
UParticleSystemComponent
“Particles/ParticleSystemComponent.h”
UUserWidget
“Blueprint/UserWidget.h”
弃用函数
AttachTo
替代1:AttachToComponent
函数声明如下:
void AttachToComponent
(
USceneComponent * Parent,
const FAttachmentTransformRules & AttachmentRules,
FName SocketName
)
丢一段使用示例:
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
SphereComponent-
UE4 C++ 编程指南

本文档针对UE4 C++编程中的常见问题提供解决方案,重点介绍如何正确引入常用的组件头文件,如UCameraComponent、USpringArmComponent等,并给出弃用函数AttachTo的两种替代方案。
最低0.47元/天 解锁文章
1257

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



