- Unreal Engine 4 Scripting with C++ Cookbook
- William Sherif Stephen Whittle
- 133字
- 2021-07-08 10:50:49
Creating a UENUM( )
C++ enum
are very useful in typical C++ code. UE4 has a custom type of enumeration called UENUM()
, which allows you to create an enum
that will show up in a drop-down menu inside a Blueprint that you are editing.
How to do it...
- Go to the header file that will use the
UENUM()
you are specifying, or create a fileEnumName.h
. - Use code of the form:
UENUM() enum Status { Stopped UMETA(DisplayName = "Stopped"), Moving UMETA(DisplayName = "Moving"), Attacking UMETA(DisplayName = "Attacking"), };
- Use your
UENUM()
in aUCLASS()
as follows:UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Status) TEnumAsByte<Status> status;
How it works…
UENUM()
show up nicely in the code editor as drop-down menus in the Blueprints editor from which you can only select one of a few values.
推薦閱讀
- Learning Neo4j
- 自己動手寫Java虛擬機(jī)
- C語言程序設(shè)計(jì)實(shí)訓(xùn)教程
- Troubleshooting PostgreSQL
- Ext JS 4 Web Application Development Cookbook
- 程序是怎樣跑起來的(第3版)
- Java Web開發(fā)詳解
- Fast Data Processing with Spark(Second Edition)
- Modern C++ Programming Cookbook
- Android應(yīng)用開發(fā)深入學(xué)習(xí)實(shí)錄
- 大學(xué)計(jì)算機(jī)應(yīng)用基礎(chǔ)(Windows 7+Office 2010)(IC3)
- WordPress Search Engine Optimization(Second Edition)
- Java面試一戰(zhàn)到底(基礎(chǔ)卷)
- 面向物聯(lián)網(wǎng)的Android應(yīng)用開發(fā)與實(shí)踐
- Python深度學(xué)習(xí):基于PyTorch