Developer Notes

This issue has been closed as 'Won't Fix' due to an extended period of time without updates. If this issue is important to you please let us know by posting on the AnswerHub or UDN, and Epic will re-open the ticket for further review.

Description

If an Enum is defined in ClassA and ClassA is included into the Project.h file, having a UFUNCTION in ClassB that takes the enum as a parameter will fail compile. Only by adding an include statement for ClassA inside of ClassB will the code compile

This is inconsistent with a non-UFUNCTION or UPROPERTY which will compile without issue.

Steps to Reproduce
  1. Open UE4 Editor (any project)
  2. Add two classes based on actor (NewActor1 & NewActor2)
  3. Add include statement for NewActor1 into ProjectName.h
  4. Add the following UENUM to NewActor1.h
    UENUM(BlueprintType)
    enum class ETeam : uint8
    {
    	None        UMETA(DisplayName = "None"),
    	Players        UMETA(DisplayName = "Players"),
    	Neutrals    UMETA(DisplayName = "Neutrals"),
    	Enemies        UMETA(DisplayName = "Enemies")
    };
    
  5. Add the following UFUNCTION to NewActor2
    UFUNCTION(BlueprintCallable, Category = "AmmoReserve")
    bool CanDamageTeam(ETeam Teams);
    
  6. Compile

Result:
Project fails to compile by saying "Unrecognized type 'ETeam ' - type must be a UCLASS, USTRUCT or UENUM"

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

13
Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.11.2
CreatedMay 25, 2016
ResolvedMar 26, 2018
UpdatedApr 27, 2018
View Jira Issue