I have a TMap in a GameInstanceSubsystem, and I’m trying to use a PrimaryDataAsset as the key. UCommonViewData is just a blank PrimaryDataAsset for now.
Error C2665 : 'GetTypeHash': no overloaded function could convert all the argument types
How can I resolve this? Should I use a pointer for the key? I just want to make sure that there is only one entry for each UCommonViewData that is created in the project.
I asked around, and I found a solution that worked for me. The solution is to avoid using a hard reference to the object and also to avoid using pointers, but instead use a FObjectKey.
bool UCommonViewSubsystem::AddInstance(UCommonViewData* Key, UCommonActivatableWidget* UI)
{
FObjectKey ObjectKey(Key); // This runs the constructor of FObjectKey using a pointer
if (DataToInstanceMap.Contains(ObjectKey))
{
//...