Districuted c++ plugin is not working in packaged exe

Hi!

I was experimenting with UE4 Plugins and I faced some complication in using my plugin in other project. I am very new to UE4 and this forum. It would be very kind if I could ask for help here. It is my first time posting here; sorry in advance if anything goes wrong. :stuck_out_tongue:

What I am trying do is to create a plugin with project1 and use it in project2. It works perfectly in project1 edit and packed exe as development. However, it works in project2 editor, but not working after packaging project2. It seems that the plugin/module is not load. Please see the detail of what I have done in the followings:

My specification
-UE4 version 4.1.0

Here is what I have done:
-create a basic code project from Launcher, namely project1
-create folder “MY_PROJECT_FOLDER/Plugins/”
-copy “C:/Program Files/Unreal Engine/4.1/Engine/Plugins/Developer/BlankPlugin” into “MY_PROJECT_FOLDER/Plugins/” and rename folder names, file names, code, etc., from “BlankPlugin” to “MyPlugin” and begin adding my code
-in the end, the file structure is like this:

filestructure.png

-Here are the sources:



// MyPlugin.uplugin
{
	"FileVersion" : 3,	
	"FriendlyName" : "My Friendly Name",
	"Version" : 1,
	"VersionName" : "1.0",
	"CreatedBy" : "thebitstudio",
	"CreatedByURL" : "",
	"EngineVersion" : 1579795,
	"Description" : "My Description",
	"Category" : "MyCategory",
	
	"Modules" :
	
		{
			"Name" : "MyPlugin",
			"Type" : "Runtime",
			"LoadingPhase" : "PostConfigInit"
		}
	]
}




// MyPlugin.Build.cs
namespace UnrealBuildTool.Rules
{
	public class MyPlugin: ModuleRules
	{
		public MyPlugin(TargetInfo Target)
		{
			PublicDependencyModuleNames.AddRange(new string] { "Engine", "CoreUObject", "Core" });
		}
	}
}




// MyPluginPrivatePCH.h
#include "Engine.h"




// MyPlugin.h
#pragma once
#include "ModuleManager.h"

class MyPlugin: public IModuleInterface
{

public:
	void StartupModule();
	void ShutdownModule();

	static inline bool IsAvailable()
	{
		return FModuleManager::Get().IsModuleLoaded("MyPlugin");
	}
};




// MyPlugin.cpp
#include "MyPluginPluginPrivatePCH.h"
#include "MyPlugin.h"
#include "MyPluginComponent.h"
#include "MyPlugin.generated.inl"

void MyPlugin::StartupModule()
{
}

void MyPlugin::ShutdownModule()
{
}

IMPLEMENT_MODULE(MyPlugin, MyPlugin)




// MyPluginComponent.h
#pragma once

#include "Components/ActorComponent.h"
#include "MyPluginComponent.generated.h"

UCLASS(meta = (BlueprintSpawnableComponent))
class UMyPluginComponent : public UActorComponent
{
	GENERATED_UCLASS_BODY()

protected:
	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) OVERRIDE;
};




// MyPluginComponent.cpp
#include "MyPluginPrivatePCH.h"
#include "MyPluginComponent.h"
#include "../Public/MyPlugin.h"

UMyPluginComponent::UMyPluginComponent(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	PrimaryComponentTick.bCanEverTick = true;
}

void UMyPluginComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::FromInt(MyPlugin::IsAvailable()));
}


-after that, I added “MyPlugin” into MY_PROJECT.Build.cs


 PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "MyPlugin" }); 

-I built my project as “Development Editor”, the editor came up. I opened “Plugin Browser” and found my plugin. I enabled it and restarted. I create a new actor blueprint and found “MyPluginComponent” under “Components” tab. I added MyPluginComponent, save, compile, and drag this actor into viewport to create a new actor, and hit “Play.” There is a lot of string “1” printed on screen by UMyPluginComponent::TickComponent() as expected.

-I packaged project1 as “development” and run the .exe file and everything looks fine (there is a lot of “1” printed). Up to this point, my plugin seems to work fine with project1. Next, I will distribute MyPlugin to another project, namely project2

-I created a new blank project (not a code project).

-I copied “PROJECT1/Plugins/MyPlugin” into “PROJECT1/Plugins/MyPlugin”

-I ran project2.uproject. The editor came up. I found my plugin in Plugin Browser, enabled it, and restarted. I created my actor just like in project1, drag the blueprint into the viewport, and hit “Play.” The string of “1” came up which is good.

-I packed my project as “Development”, and run the .exe and there is nothing came up on the screen…

-Is there any console command that I can check if my plugin is loaded?

I have tried this and that, but still can’t figured out what is wrong with my long process. It would be the most kind of you if any of you could give a hand in this.

Thanks!