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;
};