Failed to import custom component

Hello, I created two custom components but everytime I launch my map with my custom character I get following errors:

Error Failed import for COMHealthComponent /Game/Game/Character/Mannequin/BP_Mannequin.Default__BP_Mannequin_C:Health Component

Error Failed import for COMInventoryComponent /Game/Game/Character/Mannequin/BP_Mannequin.Default__BP_Mannequin_C:Inventory Component*

Here is how I create component inside character:

.h

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Health")
UCOMHealthComponent* HealthComponent;

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Inventory")
UCOMInventoryComponent* InventoryComponent;

.cpp

...constructor...
    HealthComponent = ObjectInitializer.CreateDefaultSubobject<UCOMHealthComponent>(this, TEXT("Health Component"));
    InventoryComponent = ObjectInitializer.CreateDefaultSubobject<UCOMInventoryComponent>(this, TEXT("Inventory Component"));

Component .h:

#pragma once

#include "Components/ActorComponent.h"
#include "COMHealthComponent.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class COMGAME_API UCOMHealthComponent : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UCOMHealthComponent();

I have only one reference in BP for HealthComponent and removing that does not solve issue. I need to say that even with errors it looks like everything is working.

I belive It was not happening before, maybe I create components by incorrect way or there is some bug, do you know any idea what can cause that ?

I see it is quite common error but I can’t find working solution in other threads. Log does not contain any additional info, so I belive it would be good to implement some error codes or something like that, so I will be able to find exact reason why it fails. “Failed to import” is just too simlified.

Hello ,

I have a few questions for you about this issue.

  1. Have you tried this on any versions of the engine past 4.7? Also, which hotfix version (if any) of 4.7 are you using?
  2. Is this something that only happens in your project or can it be easily recreated in a fresh project?
  3. When you say “I launch my map with my custom character” do you mean that you are opening the map in the editor, launching PIE, launching a packaged game or otherwise?

Hello , thank you for fast reaction,

  1. Today I created clone of my project and tested it in 4.9 P4, issue is still there and happens in 4.9 P4 version too.
  2. I understand it is hard to find cause without reproduction, so I will try to reproduce it in clean project today.
  3. I mean that I am opening the map in the editor, It is my default map, so right after opening editor I can see these errors.

I have bad news, I can not reproduce issue in clean project, so there is probably no way how to identify issue without better errors messages.

I did simple test and deleted blueprint which is based on my C++ character class and recreated that blueprint, It looks like error is gone.

If you have somewhere in your private tracker feature request about text based blueprint assets please bump community interest or something like that because it would solve a lot of problems and I would be able to identify difference between old and new blueprint and post proper bug report :slight_smile: