【UE4学习】13_UFUNCTION 关键字解释
来源:互联网 发布:淘宝店铺logo免费设计 编辑:程序博客网 时间:2024/05/16 23:52
在本文中,将会陆续使用程序实例来解释关键字
(1)关键字 part 1
BlueprintCallable
BlueprintImplementableEvent
Category
BlueprintCallable 进一步用法
.h
UENUM(BlueprintType)enum class EMyEnum : uint8{BranchA,BranchB};
///Category = "MyActor|Sub1" 中 "|" 为分类下的子类///Meta = (ExpandEnumAsExecs = "Branches") 代表作为执行节点输出UFUNCTION(BlueprintCallable, Category = "MyActor|Sub1", Meta = (ExpandEnumAsExecs = "Branches"))void FunTest4(int32 Input, EMyEnum& Branches);
<span style="font-size:14px;">.cpp</span>
void AMyActor::FunTest4(int32 Input, EMyEnum& Branches){if (Input==1){Branches = EMyEnum::BranchA;}else{Branches = EMyEnum::BranchB;}}
(2)关键字 part 2
BlueprintNativeEvent
该关键字,表示函数可被蓝图重载,也可被C++正常实现。当C++有实现,蓝图也有重载的时候,C++的代码被覆盖。如果此时既想要使用蓝图重载后的方法,也想使用C++实现的方法,可以在C++ 中提取函数名_Implementation() 到新的函数,以供调用。(存疑)
.h
///BlueprintNativeEvent 可在蓝图中重载,也可在C++中正常实现方法的具体内容///DisplayName 蓝图中实际调用的函数名///DeprecationMessage显示警告信息UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "MyActor",Meta=(DisplayName="FunTest5_DisplayName(...)", DeprecatedFunction, DeprecationMessage = "This FunTest5."))void FunTest5(const TArray<FString>& input, TArray<FString>& output);
.cpp
void AMyActor::FunTest5_Implementation(const TArray<FString>& input, TArray<FString>& output){}
在这里,可以看一下输入参数和输出参数的设置,带const 和不带const的区别。
(2)关键字 part3
Exec
此函数可从游戏中的控制台中执行。Exec命令仅在特定类中声明时才产生作用。包括:
Player Controllers,
Player Input,
Cheat Managers,
Game Modes,
Game Instances,
overriden Game Engine classes,
Huds
具体参考:点击打开链接
MyPawn.h
UFUNCTION(Exec)void SetValue(float Value);</span>
MyPawn.cpp
void AMyPawn::SetValue(float Value){}
参考 :
1、UE4 UFUNCTION Keywords Explained
2、Function definitions (Official Docs)
3、Extending Blueprints
4、UF::
5、分享C++寫blueprint block的方法
0 0
- 【UE4学习】13_UFUNCTION 关键字解释
- UE4学习笔记13th
- 学习ue4
- ue4 学习
- 关键字解释
- 解释关键字
- <Unity3d学习笔记二>两个比较困惑的关键字解释
- UE4学习笔记(一):初识UE4
- UE4学习笔记: Functions
- UE4学习笔记: Properties
- UE4学习笔记: Replication
- UE4引擎学习
- UE4 学习笔记
- UE4学习资料搜集
- 开始学习UE4
- UE4学习笔记: Functions
- UE4学习笔记: Properties
- UE4学习笔记: Replication
- 机器学习笔记
- 51nod-1405 树的距离之和
- DigitRecongnizer_CNN_DeepLearning
- 课堂小结——Html中的几种布局简单比较
- 生成随机数源代码-C++
- 【UE4学习】13_UFUNCTION 关键字解释
- Codeforces 691E Xor-sequences【矩阵快速幂,好题】
- 分布式理论之一:Paxos算法的通俗理解
- Burp Suite出了一个类似cloudeye.me的功能
- lnmp下配置PHP虚拟主机vhost
- 用Meta标签代码让360双核浏览器默认极速模式打开网站不是兼容模式
- CSS3快速上手之18:图片的格式操作
- 一些安全软件
- Jersey_Client程序的编写和运行