C++ 4.16 Transition Guide

Just upgraded Able to 4.16 and it wasn’t too crazy (4.15 was WAYYYY worse). Change your Build.cs as others have shown, and fix up any now deprecated method calls.

@Sveitar, change your Add to AddUnique and you can filter out duplicate entries at that level. Granted the behavior probably shouldn’t have changed, but still - at least that will keep you going.



PlayableMaps.AddUnique(AssetList*);


My Wwise audio plugin is using a line that throws an error:


public static string GetDefaultVersionFileName()
    {
        return Path.Combine(UnrealBuildTool.UnrealBuildTool.EngineDirectory.FullName, "Build" + Path.DirectorySeparatorChar + "Build.version");
    }

It says that “UnrealBuildTool.UnrealBuildTool” is unaccessible due to its protection level"

It also throws the error that .EngineDirectory is not valid

I cannot find any documentation on the UnlrealBuildTool stuff though; it seems like they may have made it protected in 4.16? Is there a more preferred way to access the engine directory?

I’ve no idea what calls that method you have there, but I’m using this in another place in Build.cs:
Path.GetFullPath(BuildConfiguration.RelativeEnginePath)
Maybe it helps?

Using that throws the following error:

error CS0120: An object reference is required for the non-static field, method, or property ‘UnrealBuildTool.ModuleRules.BuildConfiguration.get’

Additionally, I am getting the error that @v.s. was getting here:

I think it might be related to this function not getting the correct engine directory. Thanks for your help

Edit: I was able to fix the BuildConfiguration.RelativeEnginePath error by making the function declaration not static. I am not a great coder. It works great.

However, the FIOSystem errors persist. I do not see any documentation that it has been removed, so I am not sure what is causing it.

According to a post over at Wwise, somebody had a similar issue when upgrading to 4.14:

So it seems to be an error that crops up on upgrades, not just to 4.16 in particular

Edit 2: Looking at their source code on github, it does indeed look like IOBase.h, which contained FIOSystem, has been removed from the engine. So I’m not sure what to do about that!

I have not migrated yet from 4.15, but one good way to solve many of these transition errors is by creating a new 4.16 project using template. Check the syntax and adjust accordingly.

Better yet, create the same template in 4.15 and 4.16 and use a diff tool on the source.

I still get 2 of these warnings during UAT when building from the project launcher:

"
UnrealBuildTool: h:\Unreal Projects\MyGame\Source\MyGame\MyGame.Build.cs(6,12) : warning CS0618: ‘UnrealBuildTool.ModuleRules.ModuleRules()’ is obsolete: ‘Please change your module constructor to take a ReadOnlyTargetRules parameter, and pass it to the base class constructor (eg. “MyModuleRules(ReadOnlyTargetRules Target) : base(Target)”).’

UnrealBuildTool: H:\Unreal Projects\MyGame\Source\MyGame\MyGame.Build.cs: warning: Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
"

This is what the target file looks like right now, but dosen’t seem to be correct.



using UnrealBuildTool;
using System.Collections.Generic;

public class MyGameTarget : TargetRules
{
	public MyGameTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Game;
        ExtraModuleNames.Add("MyGame");
        bUsesSteam = true;
	}


Your target.cs is good, the errors are from your build.cs. Look at a few posts up how to fix those

Oh geez, this is what happens after crunching 35h x_x
Thanks a lot for helping silly me! :o
<3

Now im off to fight with the steam audio module which is throwing a fit.

Forgot to Generate Visual Studio project files…sigh…

Solved:
cannot open source file “ClothingSimulationFactoryInterface.h” UE4 e:\UnrealEngineSource\Engine\Source\Runtime\Engine\Classes\Components\SkeletalMeshComponent.h
cannot open source file “ClothingSimulationInterface.h” UE4 e:\UnrealEngineSource\Engine\Source\Runtime\Engine\Classes\Components\SkeletalMeshComponent.h
cannot open source file “ClothingSystemRuntimeTypes.h” UE4 e:\UnrealEngineSource\Engine\Source\Runtime\Engine\Classes\Components\SkeletalMeshComponent.h

Couldn’t find target rules file for target ‘CrossCompilerTool’ in rules assembly ‘UE4Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’. CrossCompilerTool

Some key stuff in UnrealBuildTool lost its public class status in a January 30th merge (see UEBuildTarget.cs commit history).

Personally I was using it for this in my Target.cs / Editor.Target.cs:

List<DirectoryReference> AllGameFolders = DiscoverAllGameFolders();

Fortunately I can derive what I need from some of the new variables like “ProjectFile” that were added to TargetRules (from which all Target.cs inherit):

string PROJECT_PATH = DirectoryReference.FromFile(ProjectFile).ToString();

There’s definitely some lost access here that kinda sucks, but I managed to get it working for my purposes. Hopefully you will, too.

Does anyone else experience out-of-date build information after moving his project to 4.16?
When I hit build (and it builds fine) the UHT does not seem to switch out the debug files and executables with the most recent version. And if I want to debug my code, it says that the breakpoints are not going to be hit because the source files do not match the original version (that’s being debugged).
It works fine though if I delete all files manually, regenerate project files and hit build.

Help would be much appreciated!

I have the same problem since I upgraded from 4.14 to 4.16, before that it never came up.
The actual error inside SceneManagement.h seems to change (I had the same error “identifier “FDrawingPolicyRenderState” is undefined” before, but now :


Error (active)	declaration is incompatible with "FLogCategoryLogBufferVisualization LogBufferVisualization" (declared at line 47 of "c:\Program Files\Epic Games\UE_4.16\Engine\Source\Runtime\Engine\Public\SceneManagement.h")

Rebuilding the solution then builds it successfully.

Somebody has an idea what the issue could be? It’s quite annoying having to rebuild constantly :-/

I’m using Visual Studio 2015 btw,
is this still the recommended version, or should I already upgrade to 2017 for 4.16?

I’ve noticed a serious memory leak in Crash Reporter after upgrading to 4.16. Within seconds it eats all my ram and freezes my PC entirely. Only restart helps.

Example event: Tried to get a custom component from a Character pointer which was null, reporter process pops up but there’s no crash window. In 5 secs everything dies.

Edit:
Cleaning and rebuilding neither the engine or my project worked. Had to clone the repo again a build again. It works now.

I get this compile error in D3D12StateCachePrivate.h on this line:
D3D12_STATE_CACHE_INLINE void FD3D12StateCacheBase::SetPipelineState(FD3D12PipelineState* PSO)

The class name is included in the function definition. I removed it and it now compiles. Did I get the right build? How is anyone building this?

Also, I’m getting crashes in FShaderResource::FindOrCreateShaderResource which calls FShaderResource::FindShaderResourceById and fails the assert on IsInGameThread(). This happens when creating a new Material and adding TextureSampleParameter2D for example. My build has some changes, but nothing that affects the thread that shader resources are used in. Anyone know what would cause this?

edit:
I ran this in debug mode and the main thread and RenderThread 5 are running at the same time. RenderThread 5 is calling FindOrCreateShaderResource from FinishCompileShader. Currently, ENamedThreads::RenderThread is set to ActualRenderingThread, not GameThread, so that assert can never pass. Anyone know what this is all about?

I got this while trying to migrate to 1.16:

error MSB3075: The command “C:\libs\UnrealEngine\Engine\Build\BatchFiles\Build.bat CrossCompilerTool Win64 Development -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command.

Running the command by hand gives me this:

ERROR: Couldn’t find target rules file for target ‘CrossCompilerTool’ in rules assembly ‘UE4Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.
Location: C:\libs\UnrealEngine\Engine\Intermediate\Build\BuildRules\UE4Rules.dll

I can still open the editor btw.
Anyone fixed this one?

Thanks.

I’m finding the UE 4.16 editor to be completely unstable. Keeps crashing when you do anything with the material editor. I haven’t tried the other editors yet.

I agree anyone else having odd crashes? Im getting them on just calling GetWorld info like 5 seconds after the world is loaded.

Its called 5 seconds after the actor has been created fully

I’ve been in the material editor quite a bit and I’ve been good… You should consider posting on the answerhub and provide more details… If its a bug, I am sure others may have this happening…

teak

It’s nothing to do with GetWorld, from within DetermineCover you’re calling a method on a NULL AAIController_Base object.