UE4 官方文档C++编程教程笔记

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

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-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值