- 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.
推薦閱讀
- 數(shù)據(jù)科學實戰(zhàn)手冊(R+Python)
- UI設(shè)計基礎(chǔ)培訓教程
- C++ Primer習題集(第5版)
- AngularJS Web Application Development Blueprints
- Network Automation Cookbook
- PyTorch自然語言處理入門與實戰(zhàn)
- Java深入解析:透析Java本質(zhì)的36個話題
- Visual C++開發(fā)入行真功夫
- Go語言精進之路:從新手到高手的編程思想、方法和技巧(1)
- 精通Python自動化編程
- OpenCV 4計算機視覺項目實戰(zhàn)(原書第2版)
- MySQL入門很輕松(微課超值版)
- 高性能MVVM框架的設(shè)計與實現(xiàn):San
- 移動智能系統(tǒng)測試原理與實踐
- Java無難事:詳解Java編程核心思想與技術(shù)(第2版)