what is the correct way of adding public dependencies path for plugin modules

im following this guide to make my own k2Nodes :

to summarize it, it says you need two modules in a plugin, one for runtime and one for editor in editor module build.cs file i should add this :

 PublicIncludePaths.AddRange(
        new string[] {
            "YourRunTimeModule",
            "YourRunTimeModule/Public"
           // ... add public include paths required here ...
        }
    );

but i get this warning when trying to compile :
warning : Referenced directory ‘C:\Program Files\Epic Games\UE_5.1\Engine\Source\YourRunTimeModule/’ does not exist.
warning : Referenced directory ‘C:\Program Files\Epic Games\UE_5.1\Engine\Source\YourRunTimeModule/Public’ does not exist.

and later when writing custom nodes i get a ton of error messages
so the workaround i found is that instead of writing “YourRunTimeModule” and “YourRunTimeModule/Public” i wrote the full path to my plugin like this:

 PublicIncludePaths.AddRange(
        new string[] {
            "D:/Projects/SampleProjectP/Plugins/MyPlugin/Source/YourRunTimeModule",
            "D:/Projects/SampleProjectP/Plugins/MyPlugin/Source/YourRunTimeModule/public"
           // ... add public include paths required here ...
        }
    );

and it works but just because it works doesn’t mean its correct, if i wanted to give this plugin to someone else or change the projects paths i need to rewrite this
what is correct way of writing it?

well it seems i wasn’t searching hard enough all i had to do was this

using System.IO
.
.
.
.
 PublicIncludePaths.AddRange(
        new string[] {
           Path.Combine(PluginDirectory,"Source/YourRunTimeModule"),
           Path.Combine(PluginDirectory,"Source/YourRunTimeModule/public"),

           // ... add public include paths required here ...
        }
    );
1 Like