# BP inherenting from c++ class in separate module?

**URL:** <https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849>\
**Category:** Blueprint\
**Tags:** actor, inheritance, modules, unreal-engine, CPP, Blueprint, question\
**Created:** [June 16, 2017, 4:53pm UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849 "2017-06-16T16:53:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_7f256138](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7f256138](https://forums.unrealengine.com/u/anonymous_user_7f256138)\
**Post date:** [June 16, 2017, 4:53pm UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/1 "2017-06-16T16:53:42Z")

</div>

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;

	
};

```

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [June 16, 2017, 8:11pm UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/2 "2017-06-16T20:11:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7f256138](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7f256138](https://forums.unrealengine.com/u/anonymous_user_7f256138)\
**Post date:** [June 16, 2017, 8:20pm UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/3 "2017-06-16T20:20:47Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [June 17, 2017, 2:00am UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/4 "2017-06-17T02:00:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7f256138](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7f256138](https://forums.unrealengine.com/u/anonymous_user_7f256138)\
**Post date:** [June 17, 2017, 2:07am UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/5 "2017-06-17T02:07:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7f256138](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7f256138](https://forums.unrealengine.com/u/anonymous_user_7f256138)\
**Post date:** [June 17, 2017, 2:24am UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/6 "2017-06-17T02:24:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7f256138](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7f256138](https://forums.unrealengine.com/u/anonymous_user_7f256138)\
**Post date:** [June 17, 2017, 7:41pm UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/7 "2017-06-17T19:41:15Z")

</div>

I opened up a new [question](https://answers.unrealengine.com/questions/668941/unresolved-external-symbol-error-with-module.html) that may have something to do with the editor crashes.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [June 17, 2017, 8:37pm UTC](https://forums.unrealengine.com/t/bp-inherenting-from-c-class-in-separate-module/398849/8 "2017-06-17T20:37:12Z")

</div>

Ok i convert my solving comment as a anwser then
