forked from cotes2020/jekyll-theme-chirpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 2024-09-14-UE5 BlueprintNativeEvents.md
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: UE5 BlueprintNativeEvents | ||
date: 2024-09-14 15:52 +0800 | ||
categories: | ||
- Game Development | ||
- Unreal Engine | ||
tags: | ||
- ue | ||
- ufunction | ||
--- | ||
**BlueprintNativeEvents** 是 **UFUNCTION** 的一个函数说明符,作用是指定一个函数,使其可以在C++中实现,并且同时可以在蓝图中被重载 | ||
|
||
与 **BlueprintImplementableEvents** 不同,它不仅可以有蓝图实现,而且可以拥有一个C++实现 | ||
|
||
## 具体使用 | ||
|
||
```cpp | ||
///Header (.h) function definition: | ||
//Override in BP to extend the base C++ functionality! | ||
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="JoyBall") | ||
float GetArmorRating() const; | ||
|
||
///////////////// | ||
|
||
///Source (.cpp) function Implementation: | ||
float AJoyBall::GetArmorRating_Implementation() const | ||
{ | ||
//remember to call super / parent function in BP! | ||
V_LOG("C++ Happens First"); | ||
return 100; | ||
} | ||
``` | ||
在蓝图重载函数中,可以调用父函数来使用C++的实现,并在此基础上进行扩展,或者不调用父函数,完全重写此函数 | ||
## 参考 | ||
[Tutorial: BlueprintNativeEvents Unreal Engine Community Wiki (unrealcommunity.wiki)](https://unrealcommunity.wiki/blueprints-empower-your-entire-team-with-blueprintnativeevents-x4fs54ut) |