So I was adding files for new system in our game and I run into a weird problem.
I added 2 classes inheriting from UActorComponent and then continued to use them in another class
#pragma once
#include "GameFramework/Actor.h"
#include "TokenBase.generated.h"
UCLASS()
class NANOT_API ATokenBase : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = AmmoType)
TSubobjectPtr<UAmmoTypeBase> AmmoType;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = WeaponType)
TSubobjectPtr<UWeaponTypeBase> WeaponType;
};
Now here is the weird part. Although both classes UWeaponTypeBase and UAmmoTypeBase look the same, and they are placed in same folder […/Classes/Combat/], UWeaponTypeBase is giving me errors C2065 ‘undeclared identifier’ and C2923 ‘not a valid template’. But if I leave only UAmmoTypeBase in code, all compiles fine…
PCIP Init looks same for both also… I know I can fix it by adding include to class, but this drives me crazy. Why one of them works fine without include, and other does not?