How do I get the UE4 source path in my plugin build config?

How do I get the source path in the build config? I’m trying to add some private paths to the include paths as per some of the samples, but without using relative paths ("…/…/this/kinda/nonsense").

It’s similar to this question:

Keen on knowing this as well. I see a method called “UEBuildConfiguration.UEThirdPartySourceDirectory”, what’s the equivalent for the project directory?

I think you may be looking for


or possibly


Good answer, and by the way, if you want get the string, use string EnginePath = UnrealBuildTool.UnrealBuildTool.EngineSourceDirectory.FullName;

This no longer works in 4.16. Is there a new solution to getting the EngineDirectory?

I would so much like to know this too. Also working in 4.16

I think this should work:

using System;
using System.IO;
using UnrealBuildTool;

namespace UnrealBuildTool.Rules
	public class NativeLibPlugin : ModuleRules

        private string ModulePath {
            get { return ModuleDirectory; }

        private string EnginePath {
            get { return Path.GetFullPath(BuildConfiguration.RelativeEnginePath); }

        private string ThirdPartyPath {
            get { return Path.GetFullPath( Path.Combine( ModulePath, "..", "..", "ThirdParty" ) ); }

        public NativeLibPlugin(TargetInfo Target) {

/* ... */