/// This function fulfills a contract of producing no side effects, and additionally implies BlueprintCallable.
BlueprintPure,
BlueprintPure:感觉BlueprintPure修饰的函数和BlueprintCallable没太大区别,在C++和蓝图都可以调用,但是BlueprintPure修饰的函数必须有函数返回值或者函数参数输出;否则编译失败: LogCompile: Error: BlueprintPure specifier is not allowed for functions with no return value and no output parameters.
UFUNCTION(BlueprintPure)
void TestPureFunc(int& a);//编译通过
UFUNCTION(BlueprintPure)
void TestPureFunc(int a);//编译失败
UFUNCTION(BlueprintPure)
int TestPureFunc();//编译通过
UFUNCTION(BlueprintPure)
void TestPureFunc();//编译失败
UFUNCTION(BlueprintPure)
int TestPureFunc(int a);//编译通过
UFUNCTION(BlueprintPure)
int TestPureFunc(int& a);//编译通过
本文详细解析了UnrealEngine中BlueprintPure修饰符的使用规则,强调了其与BlueprintCallable的区别,即BlueprintPure修饰的函数必须有返回值或输出参数,且不能有副作用。
4924

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



