# BeginPlay not called for actor in plugin

**URL:** <https://forums.unrealengine.com/t/beginplay-not-called-for-actor-in-plugin/311762>\
**Category:** Plugins\
**Tags:** actor, beginplay, unreal-engine, Plugins, UE4, CPP, question\
**Created:** [March 19, 2015, 9:03pm UTC](https://forums.unrealengine.com/t/beginplay-not-called-for-actor-in-plugin/311762 "2015-03-19T21:03:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon4339443](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon4339443](https://forums.unrealengine.com/u/anon4339443)\
**Post date:** [March 19, 2015, 9:03pm UTC](https://forums.unrealengine.com/t/beginplay-not-called-for-actor-in-plugin/311762/1 "2015-03-19T21:03:25Z")

</div>

I am new to the Unreal engine and I am trying to add a custom actor to a plugin. So far I have managed to create the plugin and the actor independently. However when I move the actor code inside my plugin, the actor doesn’t behave as expected. For example the _BeginPlay_ method doesn’t get called.

Looking at the code should give you a better idea of what I am doing and hopefully you can spot my mistake.

MyActor.h:

```
#pragma once

#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

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

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;
};

```

MyActor.cpp:

```
#include "MyProject.h"
#include "MyActor.h"

// Sets default values
AMyActor::AMyActor()
{
 	// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
}

// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
	Super::BeginPlay();
    UE_LOG(LogTemp, Warning, TEXT("I am AMyActor"));
}

// Called every frame
void AMyActor::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
}

```

As you can see, the actor simply prints out a message when _BeginPlay_ is called. When the above code is located inside my project, I can create the actor in the editor and when I hit play I see the message in the log.

When I then move the code inside my plugin (I had to adjust a few includes), I can still create the actor in the editor but when I hit play I can’t see any message in the log.

I am probably doing something silly but I can’t work out why _BeginPlay_ gets called in one case and not the other. I have been using the Paper2D plugin as an example and I noticed that _APaperSpriteActor_ is pretty much empty and the implementation was moved inside a component. Maybe it is how I am supposed to do it.

Can anyone see what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![anon4339443](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon4339443](https://forums.unrealengine.com/u/anon4339443)\
**Post date:** [March 20, 2015, 5:41pm UTC](https://forums.unrealengine.com/t/beginplay-not-called-for-actor-in-plugin/311762/2 "2015-03-20T17:41:19Z")

</div>

I deleted all the _Binarie_ and _Intermediate_ folders in my project to force a full build and now it works. Not sure what happened there.
