Making a “Basic Code” C++ project and creating a class that has “TSubclassOf<UOtherClass> otherClass;” in it’s header causes HTML5 packaging to fail.
A.h
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "B.h"
#include "A.generated.h"
/**
*
*/
UCLASS()
class TSUBCLASSTEST_API UA : public UObject
{
GENERATED_BODY()
TSubclassOf<UB> Bclass;
};
B.h
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "B.generated.h"
/**
*
*/
UCLASS()
class TSUBCLASSTEST_API UB : public UObject
{
GENERATED_BODY()
};
Packaging works fine for Win32, regular Visual Studio compilation works.
HTML5 packaging error:
UATHelper: Packaging (HTML5): UnrealBuildTool: [2/3] python.exe A.cpp
UATHelper: Packaging (HTML5): UnrealBuildTool: In file included from C:/Users/<User>/Projects/TSubclassTest/Source/TSubclassTest/A.cpp:3:
UATHelper: Packaging (HTML5): UnrealBuildTool: C:\Users\<User>\Projects\TSubclassTest\Source\TSubclassTest\A.h(18,25): error: implicit instantiation of undefined template 'TSubclassOf<UB>'
UATHelper: Packaging (HTML5): UnrealBuildTool: ../../../../../Users/<User>/Projects/TSubclassTest/Source/TSubclassTest/A.h:18:25: error: implicit instantiation of undefined template 'TSubclassOf<UB>'
UATHelper: Packaging (HTML5): UnrealBuildTool: TSubclassOf<class UB> Bclass;
UATHelper: Packaging (HTML5): UnrealBuildTool: ^
UATHelper: Packaging (HTML5): UnrealBuildTool: Runtime/CoreUObject/Public/Templates/Casts.h:21:30: note: template is declared here
UATHelper: Packaging (HTML5): UnrealBuildTool: template<class TClass> class TSubclassOf;
UATHelper: Packaging (HTML5): UnrealBuildTool: ^
Any ideas on how to fix this?