# How to create your own ScriptGenerator

**URL:** <https://forums.unrealengine.com/t/how-to-create-your-own-scriptgenerator/336674>\
**Category:** Plugins\
**Tags:** uht, build, unreal-engine, ubt, Plugins, question\
**Created:** [October 27, 2015, 4:10pm UTC](https://forums.unrealengine.com/t/how-to-create-your-own-scriptgenerator/336674 "2015-10-27T16:10:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c5d5991f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c5d5991f](https://forums.unrealengine.com/u/anonymous_user_c5d5991f)\
**Post date:** [October 27, 2015, 4:10pm UTC](https://forums.unrealengine.com/t/how-to-create-your-own-scriptgenerator/336674/1 "2015-10-27T16:10:21Z")

</div>

I’m working on a language plugin for Unreal, and I’ve been trying to figure out how does UHT pick up your own `ScriptGenerator` plugin. By reading the source code, I understand I should inherit from `IScriptGeneratorPluginInterface` and do something like `IModularFeatures::Get().RegisterModularFeature(TEXT("ScriptGenerator"), this);` at startup.  
However, I’ve been having trouble to even get my module loaded.

By following `ScriptGeneratorPlugin` example, I’ve made a new plugin with the following `.uplugin`:

```
{
	"FileVersion" : 3,
	"FriendlyName" : "UE4Haxe Extern Generator plugin",
	"Version" : 1,
	"VersionName": "alpha",
	"FriendlyVersion" : "1.0",
	"EngineVersion" : "4.8.0",
	"Description" : "Automatically generate externs from UHT definitions",
	"Category" : "Scripting",
	"EnabledByDefault" : true,
	"IsBetaVersion" : true,
	"Modules" :
	[
		{
			"Name" : "HaxeExternGenerator",
			"Type" : "Program",
			"LoadingPhase" : "PostConfigInit"
		}
	]
}

```

Right now my implementation of the module just consists of stub calls. For example, the header is:

```
#pragma once

#include <IScriptGeneratorPluginInterface.h>
#include <Modules/ModuleManager.h>

class IHaxeExternGenerator : public IScriptGeneratorPluginInterface
{
public:
  static inline IHaxeExternGenerator& Get() {
    return FModuleManager::LoadModuleChecked<IHaxeExternGenerator>("HaxeExternGenerator");
  }

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

```

And the C++ file implements all abstract functions from `IScriptGeneratorPluginInterface` and `StartupModule`/`ShutdownModule`. The C++ code also calls `IMPLEMENT_MODULE(FHaxeExternGenerator, HaxeExternGenerator)`

The strange part is that when the `.uplugin` is defined as a program - like it is right now - UBT won’t even build it when building the main project. When I change it to `Editor`, it does build, but the resulting module doesn’t get loaded in `UBT` in time for it to be picked up by `UHT`.

Am I missing something?

---

<div class="post-metadata">

**Author:** ![raaffc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@raaffc](https://forums.unrealengine.com/u/raaffc)\
**Post date:** [September 29, 2016, 7:03pm UTC](https://forums.unrealengine.com/t/how-to-create-your-own-scriptgenerator/336674/2 "2016-09-29T19:03:49Z")

</div>

Any answer to this question?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c5d5991f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c5d5991f](https://forums.unrealengine.com/u/anonymous_user_c5d5991f)\
**Post date:** [September 29, 2016, 7:06pm UTC](https://forums.unrealengine.com/t/how-to-create-your-own-scriptgenerator/336674/3 "2016-09-29T19:06:18Z")

</div>

It turns out you’ll need to actually change the Target.cs file of UnrealHeaderTool to make the program build, like this:
