Certainly! Here’s your post in organized, clean markdown format, ready for posting:
UE 5.4 C++ FCollisionShape Error – “Unable to find ‘class’, ‘delegate’, ‘enum’, or ‘struct’ with name ‘FCollisionShape’”
Context
I’m working on a UE 5.4 C++ project using Lyra as a base. When trying to compile my project, I get the following error:
Error: Unable to find ‘class’, ‘delegate’, ‘enum’, or ‘struct’ with name ‘FCollisionShape’
Code Example
// In MeleeWeaponInstance.h
#include "Engine/EngineTypes.h" // For FCollisionShape
#include "GameplayTagContainer.h"
#include "MeleeWeaponInstance.generated.h"
UCLASS()
class GAME_API UMeleeWeaponInstance : public UEquipmentInstance
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintPure, Category = "Melee Attack")
FCollisionShape GetWeaponSweepShape() const; // Error points here or similar line
UFUNCTION(BlueprintPure, Category = "Melee Attack")
FCollisionShape GetArmSweepShape() const;
// ...
};
What I’ve Tried
- Verified the
#include "Engine/EngineTypes.h"
is correct and in the right location. - Confirmed that
LyraGame.Build.cs
includes both"Engine"
and"PhysicsCore"
in its dependencies. - Did a full clean: deleted
Binaries
,Intermediate
,.vs
, and regenerated project files. - Confirmed no duplicate or corrupted
Build.cs
files exist.
Despite these steps, the 'FCollisionShape' not found
error consistently appears, preventing the build. I’m unsure what else to try to get the build system to correctly recognize this fundamental engine type.
Question
- What else could be causing this error in UE 5.4?
- Are there any changes in how collision types are exposed or included, or additional module dependencies required in UE 5.4 for
FCollisionShape
? - Is there a new best practice for including or referencing collision-related structs in engine code?
Any insights would be appreciated!