Spawn c++ class in blueprint Component

i have a class :

 class  AModule : public AActor

and i make a blueprint from this class ( named Module1 ),
now i have a seconde class:

class  ADeathZone : public AActor

and i want to use this class in my blueprint Module1 .
i cant see ADeathZone in the component tab. and when i try to make a ADeathZone in c++ in AModule class, UE4 crash .

What i do wrong ?

Could you provide us with a bit more info about the crash? Attach the crash logs.

link text

to do this i add in Module.h

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
	TSubobjectPtr<class ADeathZone> DeathZone;

And in module.cpp

AModule::AModule(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	DeathZone = PCIP.CreateDefaultSubobject<ADeathZone>(this, TEXT("DeathZone"));
}

but should be more simple for me to define a blueprint compenent as a blueprint

Did you add your native module as a dependency? It seams that it fails to load for module because of that.

mm i dont know, how i did this ?

Wait, you are creating a sub-object as an actor. This wont work, sub-objects must be object (Components in this case) I think. The way you link two actors together is to spawn them and then just use pointers to link them together.

Actors are different from Objects, they need to be spawned in the level. I guess your DeadZone could be just a struct or do you need it to be physically in your level?

If you want to add a component that can be placed in the world try to create an UActorComponent for this instead of an actor.

i need to spawn DeathZone inside My blueprint. as the component

So you should create a UActorComponent instead of an actor. You can not spawn an Actor as a component.

this dont work, i cant spawn a DeathZone. i want to spawn a DeathZone in a blueprint. i cant spawn a DeathZone in the world, but not in blueprint

i try : class UDeathZone : public UActorComponent but seam to dont work

ok i find. in component tab its : Child Actor

So does this work for you?