I have a special component class called Game State Component, basically it’s an actor component that can only be added to the Game State. My Game State Component is also supposed to only have one instance of itself, i.e. I can only have one Attribute Manager Component (derived class), one Actor Manager Component (another derived class), etc.
To try avoiding having to create functions I have to override in every single child class (which may not work with Blueprints either) I’m trying the template function below (doesn’t work in Blueprints but still much cleaner than the alternative), but it just refuses to compile and keeps complaining about something ridiculous.
/**
* Verifies that this component is the only one of its instance.
* If we have multiple components of the same class the game might not function properly.
* This allows us to check in one function, and just put a call in each child class on BeginPlay().
* ONLY WORKS IN C++. Blueprints don't take template functions.
*/
template<class AllocatorType>
void VerifySingleInstance() const
{
typedef TPointedToType<AllocatorType> T;
// Create array of components
TArray<T*, AllocatorType> LocComponents;
// Get components and fill array
OwningGameState->GetComponents<AllocatorType>(LocComponents, true);
// Ensure we don't have duplicates
if(LocComponents.Num() > 1)
{
// We found a duplicate, crash the game
const FString ErrorMessage = "There can only be ONE component of class (" + GetNameSafe(this) + ") in your Game State! Please check for duplicate components.";
UConnGameplayStatics::PrintScreenLog(this, ErrorMessage, 5, EConnLogType::Fatal);
}
}
I tried using a function without templates but it ALWAYS used the Game State Component base class, which obviously isn’t any good if I have an Attribute Manager Component and an Actor Manager Component (adding extra functionality in case I ever need it), since they end up finding each other as the same base class and crashing the game.
And here’s the log file:
Build started 1/8/2023 1:57:36 PM.
Logging verbosity is set to: Normal.Project "C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.sln" on node 1 (Build target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Development Editor|Win64".
ValidateProjects:
The project "UE5" is not selected for building in solution configuration "Development Editor|Win64".
Project "C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.sln" (1) is building "C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj" (2) on node 1 (default targets).
Build:
C:\UE_5.1\Engine\Build\BatchFiles\Build.bat CONN_MN_SoREditor Win64 Development -Project="C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.uproject" -WaitMutex -FromMsBuild
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" CONN_MN_SoREditor Win64 Development -Project="C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.uproject" -WaitMutex -FromMsBuild
Log file: C:\Users\impho\AppData\Local\UnrealBuildTool\Log.txt
Invalidating makefile for CONN_MN_SoREditor (working set of source files changed)
Parsing headers for CONN_MN_SoREditor
Running Internal UnrealHeaderTool "C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.uproject" "C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\Build\Win64\CONN_MN_SoREditor\Development\CONN_MN_SoREditor.uhtmanifest" -WarningsAsErrors -installed
Total of 1 written
Reflection code generated for CONN_MN_SoREditor in 2.1939658 seconds
Building CONN_MN_SoREditor...
Using Visual Studio 2022 14.34.31935 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933) and Windows 10.0.20348.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Determining max actions to execute in parallel (8 physical cores, 8 logical cores)
Executing up to 8 processes, one per physical core
Requested 1.5 GB free memory per action, 2.15 GB available: limiting max parallel actions to 1
Building 7 actions with 1 process...
[1/7] Link UnrealEditor-ConnCoreFramework.lib cancelled
[2/7] Link UnrealEditor-ConnCoreFramework.dll cancelled
[3/7] Compile Module.ConnCoreFramework.cpp
C:\UE_5.1\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectPtr.h(917): error C2794: 'Type': is not a member of any direct or indirect base class of 'TPointedToTypeImpl<AllocatorType>' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
with
[
AllocatorType=UConnActorManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): note: see reference to alias template instantiation 'TPointedToType<AllocatorType>' being compiled
with
[
AllocatorType=UConnActorManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Private\Source\ConnActorManagerComponent.cpp(25): note: see reference to function template instantiation 'void UConnGameStateComponent::VerifySingleInstance<UConnActorManagerComponent>(void) const' being compiled
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2938: 'TPointedToType' : Failed to specialize alias template [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2062: type 'unknown-type' unexpected [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2065: 'T': undeclared identifier [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2059: syntax error: ',' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): error C2665: 'AActor::GetComponents': no overloaded function could convert all the argument types [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3615): note: could be 'void AActor::GetComponents<AllocatorType>(TArray<UActorComponent *,AllocatorType> &,bool) const'
with
[
AllocatorType=UConnActorManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents<AllocatorType>(TArray<UActorComponent *,AllocatorType> &,bool) const': cannot convert argument 1 from 'unknown-type' to 'TArray<UActorComponent *,AllocatorType> &'
with
[
AllocatorType=UConnActorManagerComponent
]
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3528): note: or 'void AActor::GetComponents<AllocatorType>(TSubclassOf<UActorComponent>,TArray<UActorComponent *,AllocatorType> &,bool) const'
with
[
AllocatorType=UConnActorManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents<AllocatorType>(TSubclassOf<UActorComponent>,TArray<UActorComponent *,AllocatorType> &,bool) const': cannot convert argument 2 from 'bool' to 'TArray<UActorComponent *,AllocatorType> &'
with
[
AllocatorType=UConnActorManagerComponent
]
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3594): note: or 'void AActor::GetComponents(TArray<TObjectPtr<T>,AllocatorType> &,bool) const'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents(TArray<TObjectPtr<T>,AllocatorType> &,bool) const': could not deduce template argument for 'TArray<TObjectPtr<AllocatorType>,AllocatorType> &' from 'unknown-type'
with
[
AllocatorType=UConnActorManagerComponent
]
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3570): note: or 'void AActor::GetComponents(TArray<T*,AllocatorType> &,bool) const'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents(TArray<T*,AllocatorType> &,bool) const': could not deduce template argument for 'TArray<AllocatorType*,AllocatorType> &' from 'unknown-type'
with
[
AllocatorType=UConnActorManagerComponent
]
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3548): note: or 'void AActor::GetComponents(TArray<T,AllocatorType> &,bool) const'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents(TArray<T,AllocatorType> &,bool) const': could not deduce template argument for 'TArray<AllocatorType,AllocatorType> &' from 'unknown-type'
with
[
AllocatorType=UConnActorManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: while trying to match the argument list '(unknown-type, bool)'
[4/7] Compile Module.ConnAttributeFramework.cpp
C:\UE_5.1\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectPtr.h(917): error C2794: 'Type': is not a member of any direct or indirect base class of 'TPointedToTypeImpl<AllocatorType>' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
with
[
AllocatorType=UConnAttributeManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): note: see reference to alias template instantiation 'TPointedToType<AllocatorType>' being compiled
with
[
AllocatorType=UConnAttributeManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnToolkitCHISEL\ConnAttributeFramework\Private\Source\ConnAttributeManagerComponent.cpp(24): note: see reference to function template instantiation 'void UConnGameStateComponent::VerifySingleInstance<UConnAttributeManagerComponent>(void) const' being compiled
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2938: 'TPointedToType' : Failed to specialize alias template [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2062: type 'unknown-type' unexpected [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2065: 'T': undeclared identifier [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2059: syntax error: ',' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): error C2665: 'AActor::GetComponents': no overloaded function could convert all the argument types [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3615): note: could be 'void AActor::GetComponents<UConnAttributeManagerComponent>(TArray<UActorComponent *,UConnAttributeManagerComponent> &,bool) const'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents<UConnAttributeManagerComponent>(TArray<UActorComponent *,UConnAttributeManagerComponent> &,bool) const': cannot convert argument 1 from 'unknown-type' to 'TArray<UActorComponent *,UConnAttributeManagerComponent> &'
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3528): note: or 'void AActor::GetComponents<AllocatorType>(TSubclassOf<UActorComponent>,TArray<UActorComponent *,UConnAttributeManagerComponent> &,bool) const'
with
[
AllocatorType=UConnAttributeManagerComponent
]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents<AllocatorType>(TSubclassOf<UActorComponent>,TArray<UActorComponent *,UConnAttributeManagerComponent> &,bool) const': cannot convert argument 2 from 'bool' to 'TArray<UActorComponent *,UConnAttributeManagerComponent> &'
with
[
AllocatorType=UConnAttributeManagerComponent
]
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3594): note: or 'void AActor::GetComponents(TArray<TObjectPtr<T>,AllocatorType> &,bool) const'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents(TArray<TObjectPtr<T>,AllocatorType> &,bool) const': could not deduce template argument for 'TArray<TObjectPtr<UConnAttributeManagerComponent>,AllocatorType> &' from 'unknown-type'
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3570): note: or 'void AActor::GetComponents(TArray<T*,AllocatorType> &,bool) const'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents(TArray<T*,AllocatorType> &,bool) const': could not deduce template argument for 'TArray<UConnAttributeManagerComponent*,AllocatorType> &' from 'unknown-type'
C:\UE_5.1\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h(3548): note: or 'void AActor::GetComponents(TArray<T,AllocatorType> &,bool) const'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: 'void AActor::GetComponents(TArray<T,AllocatorType> &,bool) const': could not deduce template argument for 'TArray<UConnAttributeManagerComponent,AllocatorType> &' from 'unknown-type'
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): note: while trying to match the argument list '(unknown-type, bool)'
[5/7] Link UnrealEditor-ConnAttributeFramework.dll cancelled
[6/7] Link UnrealEditor-ConnAttributeFramework.lib cancelled
[7/7] WriteMetadata CONN_MN_SoREditor.target cancelled
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "C:\UE_5.1\Engine\Build\BatchFiles\Build.bat CONN_MN_SoREditor Win64 Development -Project="C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.uproject" -WaitMutex -FromMsBuild" exited with code 6. [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
Done Building Project "C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.sln" (Build target(s)) -- FAILED.
Build FAILED.
"C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.sln" (Build target) (1) ->
"C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj" (default target) (2) ->
(Build target) ->
C:\UE_5.1\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectPtr.h(917): error C2794: 'Type': is not a member of any direct or indirect base class of 'TPointedToTypeImpl<AllocatorType>' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2938: 'TPointedToType' : Failed to specialize alias template [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2062: type 'unknown-type' unexpected [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2065: 'T': undeclared identifier [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2059: syntax error: ',' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): error C2665: 'AActor::GetComponents': no overloaded function could convert all the argument types [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\UE_5.1\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectPtr.h(917): error C2794: 'Type': is not a member of any direct or indirect base class of 'TPointedToTypeImpl<AllocatorType>' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2938: 'TPointedToType' : Failed to specialize alias template [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(72): error C2062: type 'unknown-type' unexpected [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2065: 'T': undeclared identifier [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(75): error C2059: syntax error: ',' [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Plugins\ConnFramework\Source\ConnGameCore\ConnCoreFramework\Public\ConnGameStateComponent.h(78): error C2665: 'AActor::GetComponents': no overloaded function could convert all the argument types [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "C:\UE_5.1\Engine\Build\BatchFiles\Build.bat CONN_MN_SoREditor Win64 Development -Project="C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\CONN_MN_SoR.uproject" -WaitMutex -FromMsBuild" exited with code 6. [C:\Users\impho\OneDrive\Rapidfire\Games\CONNIPTION\Mainline\Shadows of Rage\Game\CONN_MN_SoR\Intermediate\ProjectFiles\CONN_MN_SoR.vcxproj]
0 Warning(s)
13 Error(s)
Time Elapsed 00:00:10.32
If anyone can tell me exactly what I’m doing wrong here - as it seems to be an issue with my template syntax - that would be very much appreicated. I’m incredibly new to templates and am trying to use them more often to make my framework as expandable as possible so that future updates aren’t so difficult.
Other helpful points:
- Game State Component and my other derived components are in separate modules.
- Game State Component (UConnGameStateComponent) exists in a CoreFramework module which contains base classes (custom Actor Component base class, etc.)
- Attribute Manager Component exists in an AttributeSystem module, and Actor Manager Component (currently unused, but it does exist and could be used later) exists in the same CoreFramework module as specified before.
If anything is too confusing or if you need more information let me know, I’m trying to give useful information as to what I want to do and the rationale behind WHY I want to do it, but I also talk a lot more than I probably should.
Thanks.