看不懂Unreal引擎C++函数类型

问题描述 投票:0回答:1

我是 C++ Unreal 新手。

函数() int32 AddToInventory(AInventoryActor* ActorToAdd);

在这段代码中我无法理解“int32”是什么意思?

函数() AddToInventory(AInventoryActor* ActorToAdd);

这部分代码是可以理解的:有一个函数本身及其参数。可能是 int32 意味着参数的类型,但这不太可能是真的。抱歉,如果我在文字上犯了一些错误,英语不是我的母语

c++ unreal-engine4 unreal-engine5
1个回答
0
投票

请阅读虚幻文档:

U函数
https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/GameplayArchitecture/Functions/

UFunction 是虚幻引擎 4 (UE4) 反射系统识别的 C++ 函数。任何

UObject
或蓝图函数库都可以通过将
UFUNCTION
宏放置在头文件中函数声明上方的行来将成员函数声明为 UFunction。该宏将支持函数说明符来更改 UE4 解释和使用函数的方式。

UFUNCTION([specifier1=setting1, specifier2, ...], [meta(key1="value1", key2, ...)])
ReturnType FunctionName([Parameter1, Parameter2, ..., ParameterN1=DefaultValueN1, ParameterN2=DefaultValueN2]) [const]; 

所以,就你而言...

UFUNCTION()
是一个宏,标记Reflection系统中的函数。

int32
是返回类型,一个32位整数。

AddToInventory
是函数名称。

AInventoryActor* ActorToAdd
是输入参数。

© www.soinside.com 2019 - 2024. All rights reserved.