前言
此篇仅为熟悉UEC++而做的小游戏demo。
做点程序员该做的东西-_-|| 通过小demo学习官方API文档、宏等一些基本信息(在笔记六中详细记录)
项目创建与基本设置
VS安装包:
.NET桌面开发(非必须):.NET Framework 4.6.2-4.7.1
使用C++的桌面开发(必须):Win10 SDK(默认是√的),Win11SDK(非必须)
使用C++的游戏开发(必须):UnrealEngine安装程序
单个组件(必须):
Windows 通用 CRT SDK
Visual Studio SDK
.NET Core3.1 运行时(LTS)
VS2022对应的版本 UE5/UE4.27
有问题可以去社区搜搜
编辑器
- 修改编辑器语言

- 以IDE为主,关闭下方三个点→Enable Live Coding

- Editor→Editor Preferences...→Appearance→Asset Editor Open Location(Main Window)

- 显示Place Actors Panel

- 不同引擎版本间的资产迁移:右键需要迁移的文件夹→Migrate→迁移到指定项目中的Content目录(Games目录)下

- 创建名为“_GameProgrammer”的文件夹用于文件整理
相机
创建角色:
创建角色C++类继承自Character(MyCharacter)→通过该类创建蓝图类放到 _GameProgrammer/BP文件夹下 (MyCharacter_BP)
创建相应的GameMode(选择AllClasses后选择GameMode , 命名为MyCharacter_GameMode)→通过该类创建蓝图类放到_GameProgrammer/BP文件夹下 (MyCharacter_GameMode_BP)
选择MyCharacter_GameMode_BP进行默认配置
- 在Classes/Default Pawn Class→MyCharacter_BP
- 选择MyCharacter_BP配置Mesh、坐标以及旋转

在MyCharacter.h中声明摄像机 需要添加头文件
class UCameraComponent;
class USpringArmComponent;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
UCameraComponent* FollowCamera;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
USpringArmComponent* CameraBoom;
并在MyCharacter.cpp文件中添加头文件
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"

最低0.47元/天 解锁文章

1158

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



