BP inherenting from c++ class in separate module?

This should work without issue

You sure your module is loaded? you can check that by using “module list” in console (Windows->Devlopment Tools->Output Log).

Did you added your module to uproject file so it is loaded automatically?

Note that most enigne actors are in sperate enigne modules too

Blueprintable is not really needed, it inheritable specifier and AActor already has it.

you know that UE4 removes the prefix from class name, so it will be named “MyActor”, do you searching it correctly? Also check Class Viewer in Window->Devlopment Tools, there you will have list of all UObject classes that UE4 see. By default there “actor only” and “placebale only” filters on (but you class should be visible either way),you need to disable them in menus.

Hello everyone,

I have a AMyActor class which exists in some separate module named MyModule. In the Ue4 editor I am trying to create a new blueprint where base class is AMyActor. In blueprint when I am selecting the base class that the blueprint will inherent from, it only displays Actors that exist within the game module. Moving AMyActor to the game module seems to be my only solution. However this solution doesn’t cut it, AMyActor is managed by MyModule, thus it makes since to keep AMyActor within MyModule instead of the game module. My thoughts are, I probably did something wrong with the build.cs. #include "AMyActor.h" works in the game module, MyModule is both a public and private module dependency in mygame.build.cs.

Context

Perhaps this is not possible, in which case i’ll talk a little more about my situation, so maybe I can find a work-around. If there is a solution to the above question then don’t bother reading this. Ill try to keep this short and general. MyModule has a class called World which can create something called an Entity, which is a wrapper for AMyActor. AMyActor also has a reference to the Entity that references itself. When World creates an entity it also creates a AMyActor and when a Entity is destroyed so is its AMyActor and vice-versa. All of this works fine, my only issue is making all of this “blueprintable”. Blueprint simply does not list AMyActor as a potential base class, and moving AMyActor to the game module would create a circular dependency.

Source

Source/MyModule/Public/AMyActor.h

#pragma once

#include "MyModule/Public/Entity.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyModuleActor.generated.h"

UCLASS(Blueprintable)
class MyModule_API AMyActor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMyActor();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

	// Called immediatly upon deciding to destroy the object
	virtual void BeginDestroy() override;
public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

private:
	Entity* entity;

	
};

I launched the game went to console and typed “module list” and “MyModule” was among them.

Additionally, “MyModule” is added to the uproject file with “Default” loadphase option and the “type” set to “runtime”.

All classes in my module are accessible from my game modules source code, as in I can #include any class from “MyModule” without linking errors.

However, when I create a blueprint from within the editor and when I select the base class from which it will inherent form, AMyActor is not among them or any blueprintable uclass from “MyModule”.

Thanks, that ended up working. When I went to Window->Development Tools-> Class Viewer, “MyActor” showed up, and for some reason now shows up every where in my project. Perhaps I did something that fixed it without my noticing or maybe the class viewer did. If you want, repost the comment as a answer and ill mark it as answered.

New issue…

Adding the blueprint which inherent’s MyActor to the scene works, and I can edit its blueprint without issue. The new issue is, if I try to remove the object, move the object around in the content folder or modify anything about it, ue4 crashes and the MyBlueprint which inherent’s AMyActor is also removed from the content browser.

I opened up a new question that may have something to do with the editor crashes.

Ok i convert my solving comment as a anwser then