C++ 4.16 Transition Guide

Dear Community,

Hiii everyone!

4.16 C++ Coding party time!!

This is a thread where you can share your research, solutions, and questions as you are upgrading to 4.16!

If you have an issue that may not be entirely related to code but is clearly a 4.16 upgrade issue you can also post it here and see if anyone else has had a similar experience.

Victory to Us!



Thanks for starting one of these kind of threads again Rama! :slight_smile:

It seems some things got changed code wise for sequencer. Variable “tokens” in FMovieSceneTrackIdentifier turned private and FMovieSceneExecutionTokens::FEntry is now a private struct. Is there any way to still access these tokens and work with them? Would love to know to get FaceFx working on 4.16 as soon as possible :wink:

Not strictly C++ related, but I’ve just wasted a heap of time trying to track down why the Generate Project Files command is silently failing for some of my 4.16 projects.
Turns out it’s because of dependencies on plugins that are not yet installed for 4.16 (which makes sense and was the case with previous versions too) but changes to UBT in 4.16 seem to have resulted in the error dialog not being shown, so you just get a silent failure.

So, for anyone experiencing the same issue, remember that the likely cause is plugin references inside your .uproject file. If you disable them there until the 4.16 plugin is available, you should be able to generate the project files.

I am getting this build error coming from 4.15.2 to 4.16. Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. However, I changed my project build.cs to have public Project(ReadOnlyTargetRules Target) : base(Target).

Edit: Nevermind, it was found in a plugin i am using.

Hi guys,

Finding FriendSessions now returns an array of FOnlineSessionSearchResult when using the FOnFindFriendSessionCompleteDelegate session delegate.

Your callback function needs to change from

OnFindFriendSessionsCompletedCallback(int32 LocalPlayerNum, bool bWasSuccessful, const FOnlineSessionSearchResult& SearchResult)
OnFindFriendSessionsCompletedCallback(int32 LocalPlayerNum, bool bWasSuccessful, const TArray<FOnlineSessionSearchResult>& SearchResult)

Here’s a couple of findings from me. I’ve switched my project to 4.16 a while ago so I might be missing some bits. GenerateProjectFiles.h will complain in any case.

public class MyGame : ModuleRules

    public MyGame(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules) 

This is how MyGame.Build.cs looks now.

In MyGame.Target.cs, SetupBinaries() is no longer needed. Instead, in the constructor, below Type = TargetType.Game, you do this:

That ought to cover it.

Has anyone had any difficulty getting custom vars for Post Process showing up? My new variables in Scene.h don’t seem to be appearing in the Details Panel. I suspect Post Process Volumes / Cameras now have a custom Detail Panel class, but I’m struggling to find it anywhere…

From the release notes:

“The TargetRules.SetupBinaries() callback has been deprecated. Instead of overriding this, targets may override the launch module through the “LaunchModuleName” property in their constructor, and add extra modules to the “ExtraModuleNames” field on the TargetRules object itself.”

I’m having this deprecation warning but I can’t seem to figure out how i should change it to the new standard:

public override void SetupBinaries(TargetInfo Target,
		ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
		ref List<string> OutExtraModuleNames)

Any suggestions?

EDIT: Created a new 4.16 project and checked how it is generated and from there I found the correct way.

From the above code I changed it to:

public VR_GameTarget(TargetInfo Target) : base(Target)
Type = TargetType.Editor;

I was using an FStreamableManager property in GameInstance class to load assets dynamically. This seems to no longer work in 4.16. I get the following error.

class CCAM_API UMainGameInstance : public UPlatformGameInstance

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Data")
	UWeaponData* WeaponData = nullptr;

	UPROPERTY(BlueprintReadOnly, Category = "Maps")
	FStreamableManager Assets;

C:/UEProjects/CCam/Source/CCam/GamePlay/MainGameInstance.h(23): error : Unrecognized type 'FStreamableManager' - type must be a UCLASS, USTRUCT or UENUM

This was working in 4.15. How do I fix this? Tried adding a header for StreamableManger no luck.

Just remove the UPROPERTY line above it. It’s no longer a reflected type, but since it had nothing exposed to blueprints anyway, this shouldn’t have any effect on your project.

How to fix such errors? FIOSystem was completely removed.
‘GNewAsyncIO’: undeclared identifier
‘FIOSystem’: is not a class or namespace name

Hi, I have the following issue since upgrading my project to 4.16, using Visual C++ 2015: when the Unreal Editor is launched, the build from within Visual C++ (CTRL+SHIFT+B) fails with strange errors (see below). If I close the Unreal Editor then I can compile fine from Visual C++. I didn’t have that problem with 4.15, I could build either from VC++ or Unreal when both were open.

Error (active) identifier “FDrawingPolicyRenderState” is undefined

e:\UE_4.16\Engine\Source\Runtime\Engine\Public\SceneManagement.h 1560
Error Failed to produce item: mygame-Win64-DebugGame.lib

Error MSB3075 The command “E:\UE_4.16\Engine\Build\BatchFiles\Build.bat mygame Win64 DebugGame “E:\Unreal Projects\mygame \mygame .uproject” -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command.

Hello everyone! It’s already written, but I want to collect all in one heap and show you this visually.
How to transition your C ++ project from 4.15 to new features 4.16 and get rid of the warnings about of deprecated functions.

When RC is your project name:






Could you or someone show the complete and working target.cs file? I can’t get anything to work with 4.16, it only throws compile errors. :frowning:

Edit: Well I’ve solved most critical errors, but whats up with this warning:

“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.”

(every target file throws this warning)

TMaps with custom structs (as key) now need to explicitly implement *GetTypeHash * or supply custom key funcs for the struct. Previously it was sufficient if your parent struct implemented it, now it has to be defined for each struct it seems.

For reference here’s a snippet from FGameplayTag:

/** Used so we can have a TMap of this struct */
FORCEINLINE friend uint32 GetTypeHash(const FGameplayTag& Tag)	{ return ::GetTypeHash(Tag.TagName); }

For reference (and easy googling!) here’s the actual error: TMap must have a hashable KeyType unless a custom key func is provided.

I have these now:

using UnrealBuildTool;
using System.Collections.Generic;

public class BrickSpaceTarget : TargetRules
	public BrickSpaceTarget(TargetInfo Target) : base(Target)
		Type = TargetType.Game;

using UnrealBuildTool;
using System.Collections.Generic;

public class BrickSpaceEditorTarget : TargetRules
	public BrickSpaceEditorTarget(TargetInfo Target) : base(Target)
		Type = TargetType.Editor;

They’ve been simplified quite a bit in 4.16 :smiley:

That’s a great reply. Unfortunately it seems that the error “identifier “FDrawingPolicyRenderState” is undefined” still pops from time to time. What I found out is that the error is only intellisense error. It doesn’t affect the compilation.

Thanks a lot for sharing! I don’t have any editor module entry under the game module in my editor target file tho, but it seems to work anyways :o

If you leave it out, only the game module will be compiled when building for development editor config.
Of course if your game doesn’t have an editor module, you can’t really compile one :smiley:

Hi guys! I’m having an issue with asset registry after upgrading to 4.16.

I have this little method that loads the assetdata for my game playable maps:

void UMyStatics::GetPlayableMapAssets(TArray<FAssetData>& PlayableMaps)

	FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
	IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

	TArray<FString> RootPaths;

	for (FString Path : RootPaths)
		TArray<FString> Paths;
		AssetRegistry.ScanPathsSynchronous(RootPaths, true);

		FARFilter ARFilter;
		TArray<FName> OldNames = FLinkerLoad::FindPreviousNamesForClass(UWorld::StaticClass()->GetPathName(), false);
		ARFilter.bRecursivePaths = true;
		ARFilter.bRecursiveClasses = false;

		TArray<FAssetData> AssetList;
		if (AssetRegistry.GetAssets(ARFilter, AssetList))
			for (int32 i = 0; i < AssetList.Num(); i++)
				bool bPlayable = false;
				if (AssetList*.GetTagValue<bool>(FName("bIsPlayable"), bPlayable) && bPlayable)

This was working perfectly fine with 4.14 and 4.15.
Today I upgraded my project to 4.16 and now the asset registry is giving me an array with all it’s entries duplicated.
For example, if my maps are “Map1”, “Map2”] then AssetRegistry.GetAssets() gives me “Map1”, “Map1”, “Map2”, “Map2”]