- Create a new Actor subclass in the editor, which we will name Barracks:
- Then, add the following implementation to the class:
UCLASS()class CHAPTER_04_API ABarracks : public AActor{ GENERATED_BODY() public: // Sets default values for this actor's properties ABarracks();protected: // Called when the game starts or when spawned virtual void BeginPlay() override;public: // Called every frame virtual void Tick(float DeltaTime) override; UPROPERTY() UStaticMeshComponent* BuildingMesh; UPROPERTY() UParticleSystemComponent* SpawnPoint; UPROPERTY() UClass* UnitToSpawn; UPROPERTY() float SpawnInterval; UFUNCTION()