tegleg
(tegleg)
November 22, 2014, 2:49pm
1
there has been a lot of code changes in 4.6 preview, meaning c++ projects created in an earlier build throw a lot of errors.
my project is only small so its not too much work to change it, but someone with a bigger project will face a lot of extra work.
will there be something to help convert a project?
also will the c++ tutorials (fps for example) be updated?
Hi tegleg,
The 4.6 release notes will cover the changes, and Epic’s sample projects are being updated to match. I reached out to core engineer Robert M. recently to discuss the changes and expected issues users may face when converting. This is what he had to say, I hope it sheds some light:
There shouldn’t be any major problems in general:
We renamed FPostConstructInitializeProperties to FObjectInitializer but users can still use the old name which is going to result in deprecation warnings.
All of the UObject improvements related to constructors only have affect when users use GENERATED_BODY macro (which can now be used by instead of GENERATED_UCLASS_BODY macro, but we haven’t deprecated it yet, we’ll do it for 4.7). The old GENERATED_UCLASS_BODY will still work.
We also deprecated TSubobjectPtr<> but it can still be used (resulting in deprecation warnings). We also added public accessor functions for subobjects (components) and deprecated all public subobject properties (we are not going to remove them, but make them private in 4.7). This is the only change that can cause potential breakage , for example:
ACharacter has Mesh property which no longer is a TSubobjectPtr<USkeletalMeshComponent> but a USkeletalMeshComponent* instead.
Code that used it to access its properties and methods:
SomeCharacter->Mesh->GlobalAnimRateScale = 1.0;
Is still going to compile (although with deprecation warnings) and should eventually be replaced with:
SomeCharacter->GetMesh()->GlobalAnimRateScale = 1.0;
However, if someone used any of the TSubobjectPtr’s methods, like:
SomeCharacter->Mesh.IsValid() or SomeCharacter->Mesh.Get()
Then it’s going to result in compilation errors . Note that even in our codebase both IsValid() and Get() were used in just a few places. They’re also easy to fix, one needs to only remove .IsValid() and .Get() from code, i.e:
if (SomeCharacter->Mesh.IsValid()) becomes if (SomeCharacter->Mesh)
auto CharacterMesh = SomeCharacter->Mesh.Get(); becomes auto CharacterMesh = SomeCharacter->Mesh;
Obviously this will still result in deprecation warning but code will compile (all instances of ->Mesh in the above code should be replaced with ->GetMesh()).
As for {Epic} updating documentation, I’d wait for 4.7 with anything related to GENERATED_UCLASS_BODY macro. We have more changes coming to the new GENERATED_BODY macro in 4.7. We should tell people to use FObjectInitializer instead of FPostConstructInitializeProperties and obviously to not use TSubobjectPtr<> anymore but design their classes so that all subobject properties are private and can only be accessed through public Get*() functions.
tegleg
(tegleg)
November 23, 2014, 3:41pm
3
thanks Stephen
all fine in theory, however, the shooter game throws real errors, not just warnings, and a lot of them.
luckily i dont use that but i imagine lots of people based their entire project on it.
tegleg
(tegleg)
November 27, 2014, 11:58am
4
here are just the errors from shooter game compile in 4.6 preview
11 errors, 110 warnings
Error 15 error C2039: 'PreLoadMap' : is not a member of 'FCoreDelegates' C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\ShooterGameInstance.cpp 68 1 ShooterGame
Error 16 error C2065: 'PreLoadMap' : undeclared identifier C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\ShooterGameInstance.cpp 68 1 ShooterGame
Error 17 error C2228: left of '.AddUObject' must have class/struct/union C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\ShooterGameInstance.cpp 68 1 ShooterGame
Error 18 error C2039: 'PostLoadMap' : is not a member of 'FCoreDelegates' C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\ShooterGameInstance.cpp 69 1 ShooterGame
Error 19 error C2065: 'PostLoadMap' : undeclared identifier C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\ShooterGameInstance.cpp 69 1 ShooterGame
Error 20 error C2228: left of '.AddUObject' must have class/struct/union C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\ShooterGameInstance.cpp 69 1 ShooterGame
Error 21 error C2664: 'void IOnlinePresence::SetPresence(const FUniqueNetId &,const FOnlineUserPresenceStatus &,const IOnlinePresence::FOnPresenceTaskCompleteDelegate &)' : cannot convert argument 2 from 'FPresenceProperties' to 'const FOnlineUserPresenceStatus &' C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\ShooterGameInstance.cpp 524 1 ShooterGame
Error 32 error C2664: 'bool UBehaviorTreeComponent::StartTree(UBehaviorTree &,EBTExecutionMode::Type)' : cannot convert argument 1 from 'UBehaviorTree *' to 'UBehaviorTree &' C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\Bots\ShooterAIController.cpp 31 1 ShooterGame
Error 90 error C2664: 'void IOnlinePresence::SetPresence(const FUniqueNetId &,const FOnlineUserPresenceStatus &,const IOnlinePresence::FOnPresenceTaskCompleteDelegate &)' : cannot convert argument 2 from 'FPresenceProperties' to 'const FOnlineUserPresenceStatus &' C:\UE4 Projects\ShooterGame 4.6\Source\ShooterGame\Private\Player\ShooterPlayerController.cpp 956 1 ShooterGame
Error 120 error : Failed to produce item: C:\UE4 Projects\ShooterGame 4.6\Binaries\Win64\UE4Editor-ShooterGame.dll C:\UE4 Projects\ShooterGame 4.6\Intermediate\ProjectFiles\ERROR ShooterGame
Error 121 error MSB3073: The command "C:\UnrealEngine-4.6.0-preview\Engine\Build\BatchFiles\Build.bat ShooterGameEditor Win64 Development "C:\UE4 Projects\ShooterGame 4.6\ShooterGame.uproject"" exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 ShooterGame