- Create a new StaticMeshActor class called Tree using the editor.
- Insert the following code above the class declaration:
#pragma once#include "CoreMinimal.h"#include "Engine/StaticMeshActor.h"#include "Tree.generated.h"UENUM(BlueprintType)enum TreeType{ Tree_Poplar, Tree_Spruce, Tree_Eucalyptus, Tree_Redwood};UCLASS()class CHAPTER_09_API ATree : public AStaticMeshActor{
- Add the following to the Tree class:
UCLASS()class CHAPTER_09_API ATree : public AStaticMeshActor{ GENERATED_BODY() public: // Sets default values for this actor's properties ATree(); UPROPERTY(BlueprintReadWrite) TEnumAsByte<TreeType> Type;};
- Add the following to the Tree constructor:
#include "Tree.h"#include "ConstructorHelpers.h"// Sets default values ...