How to make a private plugin/engine code to be public to game?

Hi,

What would be ways to make part of code that is private from Engine/Plugin codes to be public to Game codes?

For instance, I have to use UPrivateOBJ.h interfaces in my game code but it is private right now.

Thanks,

Morpheus? Arent that under NDA? :stuck_out_tongue: As i heared in Unreal stream 4.8 adds core support for it

UPrivateOBJ ! :slight_smile: please edit the message

You have to modify the plugin.

In the Foo.Build.cs, you’ll see a line like this:

  PublicIncludePaths.AddRange(new string[] {"NppPlugin/Public", "NppPlugin/Api" });
  PrivateIncludePaths.AddRange(new string[] {"NppPlugin/Private" });
  PublicDependencyModuleNames.AddRange(new string[] {"Core", "CoreUObject", "Engine", "NppPlugin"});

These are used by the unreal build tool to generate include paths.

Specifically: PublicIncludePaths are exported by the plugin to the game, but PrivateIncludePaths are only exported when compiling the module itself.

So to fix, you’d have to modify the plugin that contains FMyObj.h, and change the PublicIncludePaths to include the values in PrivateIncludePaths.

  PublicIncludePaths.AddRange(new string[] {"NppPlugin/Public", "NppPlugin/Api",  "NppPlugin/Private"});

I don’t believe there’s any way of doing this without modifying the plugin itself.

and how should I run specific UModule.Build.cs only with specific solution/platform ?

Complicated, you’re best off looking at an existing plugin, but basically, something like:

        // Currently, the Rift is only supported on windows and mac platforms
        if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlat
        {
    PrivateDependencyModuleNames.AddRange(new string[] { "LibOVR", "OpenGLDrv" });

            // Add direct rendering dependencies on a per-platform basis
            if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)
            {
                PrivateDependencyModuleNames.AddRange(new string[] { "D3D11RHI" });
            }
            if (Target.Platform == UnrealTargetPlatform.Mac)
            {
              AddThirdPartyPrivateStaticDependencies(Target, "OpenGL");
            }
        }

Have a look at the OculusRift plugin.