What is the difference between PublicDependencyModuleNames and PrivateDependencyModuleNames

Hi!

I’m playing with the plugin system and I’m trying to develop some small toy plugin. However there are something I cannot find documentation for.

For instance, in the build file (MyPlugin.Build.cs) there are two field, PrivateDependencyModuleNames and PublicDependencyModuleNames that I can use to “load” other header files into my plugin. For now I’m using only the public one and everything works but I have to ask a question:

When should I put a dependency into the public field and when into the private one?

4 Likes

If you’re using the same source code layout as we use internally (Source/Public and Source/Private), then PublicDependencyModuleNames will be available in the Public and Private folders, but PrivateDependencyModuleNames will only be available in the Private folder.

Where you would place the dependency would depend on whether it was needed in the Public or Private folder (most dependencies are Private since the Public folder typically contains only interfaces).

My answer in this question might also be relevant: Explanation of Source Code folder structure? - C++ - Epic Developer Community Forums

9 Likes

Thank you. Thank you also for the related link. :slight_smile: