Include a header file from project into plugin.

Hello everyone!

I’m trying to make a plugin to manage a Data Asset that is the item data base for my game. To do this I’d need to include a file called ItemsDB.h into the plugin and then I would need to get a reference to the Data Asset. Anyone knows if this is possible? If it is could you help me? There’s isn’t much documentation about plugins in UE4 so I’m a bit lost here.

Thanks in advance!

No, don’t do this.
A plugin is meant to be Engine extension, if you need something from the Game module than move it to the Plugin module instead;
The game references the plugin components, never the other way around.

Ok, so if I moved ItemsDB.h to the plugin I would still need to get a reference to the Data Asset. How could I do it?

It depends on what exactly you want to do;
If you need to get object of a Data Asset Blueprint, you could do something like this:



UPROPERTY(Category = "MyPlugin", EditInstanceOnly, meta = (AllowPrivateAccess = "true"))
	TSubclassOf<UMyObject> MyTemplate;




if (!MyTemplate->IsValidLowLevel()) {return;}
MyData = NewObject<UMyObject>(this,MyTemplate->GetFName(),RF_NoFlags,MyTemplate.GetDefaultObject());


That would spawn in memory an exact instance of your Data Asset blueprint which you can manipulate through code.