C++ Transition Guide for 4.20

It is so you can put content in that folder that you only want to deploy to that specific platform and not accidentally to other platforms. Rename the folder if the content in that folder is not platform specific.

EDIT: …or, more accurately, move this content in the editor to another folder with a different name.

Hi,
Just update to 4.20.1,
then I got also the issue right after create a new project.


Then the project won’t start, and VS2017 can’t compile.


Is Epic’s Team knows?

Hi,

In a UUserWidget, bCanEverTick is not recognized anymore:


error C2065: 'bCanEverTick': undeclared identifier

I couldn’t find any setter, any one has an idea ?

Thanks
Cedric

Edit: i commented this line and my widget still ticks correctly, so maybe it’s just not needed anymore.


warning C4996: 'FString::Printf': The formatting string must now be a TCHAR string literal. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

Instead of printf, if you need to use a non-litteral string, you can use FString::Format(string, { args });

FUniqueNetIdRepl->ToString() for a SteamID64 (always 17 characters) now returns an 18 characters string starting with “0”.

First change: bGenerateOverlapEvents from UPrimitiveComponent changed from “bGenerateOverlapEvents = bool;” to “SetGenerateOverlapEvents(bool);

Second chage: **bUseControllerViewRotation **from CameraComponent got_DEPRECATED.


Now you have to use bUsePawnControlRotation.
https://forums.unrealengine.com/core/image/gif;base64
​​
The point is: IntelliSense tells me that bUseControllerViewRotation is inaccessible, but on 4.19 that was not happening.
1b1ab926375f2c1501b6ae6ed5e2318407cc830e.png

Third chage: I’m getting errors with a function called on my Slate Widget Tick() when playing, after a few seconds
bd3c26c397dbc9ef7dd75ae5dc86108c1722d6c4.pngpt-BR to en-US … [787] LogWindows: Warning: CreateProc failed: The sistem can not find the especified file. (0x00000002)

CrashReport:
d48bc5ccb709bfb19434a330360974266f8d6bbc.png

My code:
9b550d2b0824d8d7b435b13efee2f07e2f87631b.png

As you can see, “Create”, “SetScalarParameterValue” and “SetTextureParameterValue” are inacessible (IntelliSense).
Changed the #include lines (and paths) to header file and the result was the same.

Hey,

when attempting to create a local build after upgrading our custom code engine to 4.20, i always get following error:



CommandUtils.Run: Running: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe W:\Projects\UnrealEngineHG\Saved\StrippedUAT\Engine\Source\Programs\AutomationTool\AutomationTool.csproj /property:Platform=AnyCPU /property:Configuration=Development /verbosity:minimal /nologo
ProcessResult.StdOut:     DotNETUtilities -> W:\Projects\UnrealEngineHG\Saved\StrippedUAT\Engine\Binaries\DotNET\DotNETUtilities.dll
ProcessResult.StdOut:     MobileDeviceInterface -> W:\Projects\UnrealEngineHG\Saved\StrippedUAT\Engine\Binaries\DotNET\IOS\MobileDeviceInterface.dll
ProcessResult.StdOut:   C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2052,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [W:\Projects\UnrealEngineHG\Saved\StrippedUAT\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
ProcessResult.StdOut:   Platform\Windows\UEBuildWindows.cs(11,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [W:\Projects\UnrealEngineHG\Saved\StrippedUAT\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
CommandUtils.Run: Took 1,2942171s to run MSBuild.exe, ExitCode=1
<>c.<PrintExceptionInfo>b__4_1: ==============================================================================
<>c.<PrintExceptionInfo>b__4_0: ERROR: Command failed (Result:1): C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe W:\Projects\UnrealEngineHG\Saved\StrippedUAT\Engine\Source\Programs\AutomationTool\AutomationTool.csproj /property:Platform=AnyCPU /property:Configuration=Development /verbosity:minimal /nologo. See logfile for details: 'MSBuild-2018.07.30-21.46.29.txt' 
<>c.<PrintExceptionInfo>b__4_0:        while executing task <CsCompile Project="#RedistUATProjects" Configuration="Development" Platform="AnyCPU" Tag="#StrippedUAT" TagReferences="#StrippedUAT" />
<>c.<PrintExceptionInfo>b__4_0:        at Engine\Build\InstalledEngineBuild(386)
<>c.<PrintExceptionInfo>b__4_0:        (see W:\Projects\UnrealEngineHG\Engine\Programs\AutomationTool\Saved\Logs\Log.txt for full exception trace)
<>c.<PrintExceptionInfo>b__4_1: 
<>c.<PrintExceptionInfo>b__4_1: CommandFailedException: Command failed (Result:1): C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe W:\Projects\UnrealEngineHG\Saved\StrippedUAT\Engine\Source\Programs\AutomationTool\AutomationTool.csproj /property:Platform=AnyCPU /property:Configuration=Development /verbosity:minimal /nologo. See logfile for details: 'MSBuild-2018.07.30-21.46.29.txt' 
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.CommandUtils.RunAndLog(String App, String CommandLine, String Logfile, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\AutomationUtils\ProcessUtils.cs:line 958
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.CommandUtils.RunAndLog(CommandEnvironment Env, String App, String CommandLine, String LogName, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\AutomationUtils\ProcessUtils.cs:line 911
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.CommandUtils.MsBuild(CommandEnvironment Env, String Project, String Arguments, String LogName) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildUtils.cs:line 35
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Tasks.CsCompileTask.Execute(JobContext Job, HashSet`1 BuildProducts, Dictionary`2 TagNameToFileSet) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\BuildGraph\Tasks\CsCompileTask.cs:line 132
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Node.Build(JobContext Job, Dictionary`2 TagNameToFileSet) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\BuildGraph\Node.cs:line 177
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.BuildGraph.BuildNode(JobContext Job, Graph Graph, Node Node, TempStorage Storage, Boolean bWithBanner) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\BuildGraph\BuildGraph.cs:line 700
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.BuildGraph.BuildAllNodes(JobContext Job, Graph Graph, TempStorage Storage) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\BuildGraph\BuildGraph.cs:line 629
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.BuildGraph.Execute() in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\BuildGraph\BuildGraph.cs:line 435
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 562
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.Automation.Process(String] Arguments, StartupTraceListener StartupListener) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 532
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.Program.MainProc(String] Arguments, StartupTraceListener StartupListener) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\Program.cs:line 174
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.Program.&lt;&gt;c__DisplayClass1_0.&lt;Main&gt;b__2() in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\Program.cs:line 100
&lt;&gt;c.&lt;PrintExceptionInfo&gt;b__4_1:    at AutomationTool.InternalUtils.RunSingleInstance(Func`1 Main) in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 725
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Program.Main() in W:\Projects\UnrealEngineHG\Engine\Source\Programs\AutomationTool\Program.cs:line 100
<>c.<PrintExceptionInfo>b__4_1:    data: EpicGames.Context = ("while executing task <CsCompile Project="#RedistUATProjects" Configuration="Development" Platform="AnyCPU" Tag="#StrippedUAT" TagReferences="#StrippedUAT" />", "at Engine\Build\InstalledEngineBuild(386)")
<>c.<PrintExceptionInfo>b__4_1: ==============================================================================


The Microsoft.VisualStudio.Setup.Configuration.Interop.dll is correctly located inside of the Engine\Binaries\ThirdParty\VisualStudio folder.
No matter if i try to use -2015 in RunUAT, it will always result in the same error.

This is my RunUAT command:



./RunUAT.bat BuildGraph -target=”Make Installed Build Win64” -script=Engine/Build/InstalledEngineBuild.xml -set:WithMac=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=false -set:WithHTML5=false -set:WithSwitch=false -WithDCC=false


When i directly open the UnrealBuildTool.csproj located in Engine/Source/Programs/UnrealBuildTool, which seems to be the cause of that RunUAT error (no matter if VS 2015 or 2017), it will compile properly.

Can anyone help me with this?

Have a bunch of user widgets and never declared them as bCanEverTick and they Tick() just fine. Looks like it was never needed.

Iterating currently loaded streaming levels changed slightly. This:



// 4.18 code to iterate all streaming level and hide them
TArray<ULevelStreaming*>& streamedLevels = GetWorld()->StreamingLevels;
 for (ULevelStreaming* streamingLevel : streamedLevels)
 {
     streamingLevel->bShouldBeVisible = false;
 }


changed to:



  // 4.20 code to iterate all streaming level and hide them
  const TArray<ULevelStreaming*>& streamedLevels = GetWorld()->GetStreamingLevels();
  for (ULevelStreaming* streamingLevel : streamedLevels)
  {
    streamingLevel->SetShouldBeVisible(false);
  }


Epic changed most of internal public variables into private. You should swap those lines with related getter/setter functions.

Hi,

I have been using FSlateDynamicImageBrush forever and now i sometimes get some crashes.

Debug points to this code in FSlateDynamicImageBrush.h:


// @Todo Slate - Hack:  This is to address an issue where the brush created and a GC occurs before the brush resource object becomes referenced
// by the Slate resource manager. Don't add objects that are already in root set (and mark them as such) to avoid incorrect removing objects
// from root set in destructor.
if (!Object->IsRooted())
{
  ensureMsgf(false, TEXT("This hack usually results in a crash during loading screens in slate.  Please change any code that arrives here to not use FSlateDynamicImageBrush.  In the case of loading screens, you can use FDeferredCleanupSlateBrush.  Which correctly accounts for both GC lifetime, and the lifetime of the object through the slate rendering pipeline which may be several frames after you stop using it."));

  Object->AddToRoot();
  bRemoveResourceFromRootSet = true;
}

I am not using FSlateDynamicImageBrush in the context of loading screens at all, just regular pictures on 3D widgets.

Anyway i have replaced FSlateDynamicImageBrush by FDeferredCleanupSlateBrush and it works fine.

Another way was to use the same hack: precede all my calls with an “if source picture isn’t rooted then add it to root”.

So no real practical problem here, as soon as you are aware of it.

But anyone knows the difference ? Why all of a sudden should i stop using good old FSlateDynamicImageBrush and what does it mean for an object to be rooted ?

Should i never ever use FSlateDynamicImageBrush again ?

Cheers
Cedric

Doesn’t it seems like a change in the API with a more stable method than previous, meaning the other will be deprecated sometime ahead? Was FDeferredCleanupSlateBrush more troublesome to use in its place? Just curious…

Hi,

Pretty much the same thing, you just have to call GetSlateBrush() on the FDeferredCleanupSlateBrush to get the actual brush, so no trouble there.

Given that the code in FSlateDynamicImageBrush.h is tagged as a hack, i’m not sure whether it’s a future change in API or just a temporary problem in FSlateDynamicImageBrush, hence my post here, in case someone knew.

Cedric

Hi,
I have serious problems with packaging a runtime plugin.

it halt with an error:

ERROR: The first include statement in source file ‘D:\UE4\MyProjects\EOC\RTSPluginV178\RTS\HostProject\Plugins\RTS\Source\RTS\Private\RTSEntity\RTSObstacle.cpp’ is trying to include the file ‘RTSObstacle.h’ as the precompiled header, but that file could not be located in any of the module’s include search paths.

Earlier I got a warning:
warning: Referenced directory ‘D:\Programs\Epic Games\UE_4.20\Engine\Source\RTS\Public’ does not exist. full message:


UATHelper: Package Plugin Task (Windows): Reading plugin from D:\UE4\MyProjects\EOC\RTSPluginV178\RTS\HostProject\Plugins\RTS\RTS.uplugin...
UATHelper: Package Plugin Task (Windows): Building plugin for host platforms: Win64
UATHelper: Package Plugin Task (Windows): Running: D:\Programs\Epic Games\UE_4.20\Engine\Binaries\DotNET\UnrealBuildTool.exe UE4Editor Win64 Development -plugin=D:\UE4\MyProjects\EOC\RTSPluginV178\RTS\HostProject\Plugins\RTS\RTS.uplugin -iwyu -precompile -nosharedpch -noubtmakefiles -receipt=D:\UE4\MyProjects\EOC\RTSPluginV178\RTS\HostProject\Plugins\RTS\Bin
aries\Win64\UE4Editor.target -NoHotReload -log="D:\Programs\Epic Games\UE_4.20\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt"
UATHelper: Package Plugin Task (Windows):   Using Visual Studio 2015 14.0 toolchain (D:\VisualStudio\Microsoft Visual Studio 14.0\VC) and Windows 8.1 SDK (C:\Program Files (x86)\Windows Kits\8.1).
UATHelper: Package Plugin Task (Windows):   D:\UE4\MyProjects\EOC\RTSPluginV178\RTS\HostProject\Plugins\RTS\Source\RTS\RTS.Build.cs: warning: Referenced directory 'D:\Programs\Epic Games\UE_4.20\Engine\Source\RTS\Public' does not exist.
UATHelper: Package Plugin Task (Windows):   Parsing headers for UE4Editor
UATHelper: Package Plugin Task (Windows):     Running UnrealHeaderTool UE4Editor "D:\Programs\Epic Games\UE_4.20\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
UATHelper: Package Plugin Task (Windows):   Reflection code generated for UE4Editor in 37,8254232 seconds
UATHelper: Package Plugin Task (Windows):   ERROR: The first include statement in source file 'D:\UE4\MyProjects\EOC\RTSPluginV178\RTS\HostProject\Plugins\RTS\Source\RTS\Private\RTSEntity\RTSObstacle.cpp' is trying to include the file 'RTSObstacle.h' as the precompiled header, but that file could not be located in any of the module's include search paths.
UATHelper: Package Plugin Task (Windows):          (see D:\Programs\Epic Games\UE_4.20\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt for full exception trace)
UATHelper: Package Plugin Task (Windows): Took 108,6284721s to run UnrealBuildTool.exe, ExitCode=5
UATHelper: Package Plugin Task (Windows): ERROR: UnrealBuildTool failed. See log for more details. (D:\Programs\Epic Games\UE_4.20\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt)
UATHelper: Package Plugin Task (Windows):        (see D:\Programs\Epic Games\UE_4.20\Engine\Programs\AutomationTool\Saved\Logs\Log.txt for full exception trace)
UATHelper: Package Plugin Task (Windows): AutomationTool exiting with ExitCode=5 (5)
UATHelper: Package Plugin Task (Windows): BUILD FAILED

then I changed in my plugin called RTS the RTS.Build.cs as follows:



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

PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"));


now the compiler time warning, and the packaging warning disappears but the packaging stops with the same error complaining about an include :
ERROR: The first include statement in source file ‘D:\UE4\MyProjects\EOC\RTSPluginV178\RTS\HostProject\Plugins\RTS\Source\RTS\Private\RTSEntity\RTSObstacle.cpp’ is trying to include the file ‘RTSObstacle.h’ as the precompiled header, but that file could not be located in any of the module’s include search paths.

any hints for solving this problem?

btw I’m using VS2015Community…

A specific part of my code keeps randomly crashing in 4.20 in regards to quaternions. The breakpoint leads to

UnrealMath.cpp
// Very large inputs can cause NaN’s. Want to catch this here
“Invalid input to FRotator::Quaternion - generated NaN output: %s”

After googling it around i should not get this crash as long as i am normalizing my quaternions , but this is coming quite frequently inspite of normalizing. This wasn’t happening before 4.20 . When i check and compare the source code at UnrealMath.cpp , i notice this one difference …

This below code is commented in 4.20
SCOPE_CYCLE_COUNTER(STAT_MathConvertRotatorToQuat);

This is not commented before 4.20 , and i see this is the only main difference that can cause this NaN crash in my quaternions for which i am stuck at.

Is anybody else facing crashes related to quaternions recently ?

Anyone notice if you:

  • right click an actor
  • select Attach To >> another Actor >> select Socket

In 4.20 it no longer snaps the attached actor to the socket location? :frowning:

Tracked down what broke attaching. Engine >> Source >> Editor >> UnrealEd >> Private >> EditorEngine::ParentActors()

Old code:



[FONT=Gill Sans MT,sans-serif]// Snap to socket if a valid socket name was provided, otherwise attach without changing the relative transform
[FONT=Gill Sans MT,sans-serif]const bool bValidSocketName = !SocketName.IsNone() && ParentRoot->DoesSocketExist(SocketName);
[FONT=Gill Sans MT,sans-serif]ChildRoot->AttachToComponent(ParentRoot, bValidSocketName ? FAttachmentTransformRules::SnapToTargetNotIncludingScale : FAttachmentTransformRules::KeepWorldTransform, SocketName);



4.20 code:



[FONT=Gill Sans MT,sans-serif]// Snap to socket if a valid socket name was provided, otherwise attach without changing the relative transform
[FONT=Gill Sans MT,sans-serif]ChildRoot->AttachToComponent(ParentRoot, FAttachmentTransformRules::KeepWorldTransform, SocketName);


Seems like unintended bug because the comment does not match what the code does now. If any GitHub heroes know how to submit this please do. I don’t know much about GitHub.

I can not build my project any more. I always get the error [FONT=courier new]Cannot open inclue file: ‘new’: No such file or directory the file including [FONT=courier new]new is [FONT=courier new]PlatformCrt.h. It is an engine file located at [FONT=courier new]…\UE_4.20\Engine\Source\Runtime\Core\Public\HAL.

The file content is:


// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.

#pragma once

#include <new>
#include <wchar.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include <float.h>
#include <string.h>

How can I solve this issue?

Btw, I’m using UE 4.20.2 an VS 2017 Community.

Any solution to the covariant type problem in 4.20? This behaviour broken all blueprints that use the covariant function.

…meanwhile I was able to fix all my plugin packaging related errors. if anybody interested just pm me.