4.5 Transition Guide, Community Contributions Welcome!

Dear Community,

again is my thread where we can post what we are learning as we upgrade our projects to 4.5!

Please feel free to post any compile errors and the solutions you found while upgrading your C++ code to 4.5!

I’ll start!

**ULocalPlayer::GetUniqueNetId() Removed**

There is a new CachedID logic, and if you are not yet using it you should use GetPreferredUniqueNetId()


	 * Retrieves this player's unique net ID from the online subsystem 
	 * @return unique Id associated with this player
	TSharedPtr<class FUniqueNetId> GetUniqueNetIdFromCachedControllerId() const;

	 * Retrieves this player's unique net ID that was previously cached
	 * @return unique Id associated with this player
	TSharedPtr<class FUniqueNetId> GetCachedUniqueNetId() const;

	/** Sets the players current cached unique net id */
	void SetCachedUniqueNetId( TSharedPtr<class FUniqueNetId> NewUniqueNetId );

	 * Retrieves the preferred unique net id. This is for backwards compatibility for games that don't use the cached unique net id logic
	 * @return unique Id associated with this player
	TSharedPtr<FUniqueNetId> GetPreferredUniqueNetId() const;



**Online Session Interface


The signature for this delegate

/** Delegate after joining a session */
FOnJoinSessionCompleteDelegate OnJoinSessionCompleteDelegate;

has changed from

void AVictoryGameSession::OnJoinSessionComplete(FName SessionName, bool bWasSuccessful)


void FTestSessionInterface::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)

now to test success you use:

if (Result == EOnJoinSessionCompleteResult::Success)

Am i mistaken that FOnJoinSessionCompleteDelegate is now taking a new parameters type in 4.5?

DEFINE_ONLINE_DELEGATE_TWO_PARAM(OnJoinSessionComplete, FName, EOnJoinSessionCompleteResult::Type);

Just noticing that this wasn’t in the log (or at least I couldn’t find it.)

ps. Dang it, posted the correction before I finished typing rofl.

Hee hee!


This function now returns an FText by Reference, instead of an FString by value!


	 * Gets the text assigned to this text block
	 * @return	This text block's text string
	const FText& GetText() const
		return BoundText.Get();


LogCompile:Error: Static array cannot be exposed to blueprint HatredBaseCharacter.EmotionalsIntervals

UPROPERTY(BlueprintReadWrite, Category = "Pawn")
	float EmotionalsIntervals[EHatredEmotionalState::MAX];

So far, no clue how to fix this. This was nice feature to show enum names as indices in arrays.

The fix is pretty simple change BlueprintReadWrite to EditDefaultsOnly, this BlueprintReadWrite wasn’t intended

4.5 Is Awesome for C++ People

I’ve posted my feedback on 4.5 from C++ perspective !

It’s incredible!

I was able to upgrade my entire code base that I’ve been building since the Beta in just a few minutes!

And my compile times are twice as fast now, even when doing .h changes!

Just want to add that i have some issues with the camera / Arrow componet.
In 4.4 and erlier Ue 4 whould fix the placement (location/ rotation) the same way as a arrow component same goes for the character mesh.

My camera is attached to a socket on my chars face in PostInitzeliseComponents();
But now that nice functionality is not working any more.
And my camera is now turned 90 degres both to the side and rotation.

I’ve experienced some camera issues as well , luckily mine were easy to fix.

If you manage to fix your problem let us know, if you don’t mind, because I’m thinking of implementing a solution which resembles what you described.
Good luck!

Can i ask what problem you had and how you solved it?
And defenatly as soon as i figuer out the resson for the camera / arrow bug i will let everyone know in this thread.

Tilting your head gets old fast, lol. :slight_smile:

EDIT: Also seems Epic removed FMatrix::InverseSafe();

@anonymous_user_71cec304- Basically I changed the camera type, I’ve been meaning to change it for some time now but hadn’t wasted time looking for the right vars to make it work like I want.
I added CharacterMovement->bUseControllerDesiredRotation = true; instead of CharacterMovement->bOrientRotationToMovement = true; simply because it suited my purpose, and the wacky camera stopped being wacky to play as I wanted lol.

Though I’m pretty sure this wont help you…

Hey mate I found a fix for the camera issue, (Use Pawn Control Rotation)

Glad to hear it!

I believe this is actually a spurious error - your property is not a static array - it’s a statically-sized array member variable. It should work fine.

If you’re dealing with lights SetBrightness(float) has been replace with SetIntensity(float) .


I was experiencing issues with the CameraComponents too (mine is derived from the base third-person C++ template). Turns out that bUseControllerViewRotation property of the components is now deprecated. It won’t kick up any errors or anything during compile time, but it also won’t actually do anything during runtime due to it being an empty UPROPERTY. If you wanna see more on why it was deprecated I’d suggest peeking its definition in Visual Studio and the code comments will explain it.

Meanwhile the functionality can be achieved same as before but by using the new bUsePawnControlRotation property.

bUseControllerViewRotation should generate a deprecation warning during compilation, but those can be easy to miss. The reason it’s not an error is because we want your code to still compile :wink: I highly suggest adding the “Error List” window to your build window if you use Visual Studio, it will highlight warnings as well (and our code should compile without any warnings other than deprecation).

For people seeking more info on the deprecation, it is in the Upgrade Notes section of the release notes, but I know there were a lot and it is a bit buried. it is again:

Most of this only matters if you have saved packages/assets that use these values, if you are creating new content then it shouldn’t be an issue, the variable will just have a new name. Changing the default value of an existing property is tricky, and I apologize for any trouble it may have caused!

Lovely to hear from you Zak!

Yea I just had this issue with a client,

I set the new property to true in C++ but because we use a BP of the Character class, the value was set to false in BP

I really think this value should default to true for future engine versions! I am quite sure that this BP that had it set to false had never modified this value, so maybe it inherited as false due to how remembering BP modifications works?

Until I set this to true in BP the character could not look up or down while in game:

Again great to hear from you Zak!

's a pic for reference!

This value defaulted to false in a Character BP where it was never before modified:
It was also set to true by me in C++ but was still false in BP
Somehow the BP property overridded it back to false even tho it was never modified in BP

EDIT: I just noticed this property defaults to false in cameracomponent, while this one is set to ttrue
bUseControllerViewRotation = true;

This really needs to be fixed, I will make pull request for this

Github Pull Request Posted

I’ve posted the pull request that will clear up the confusion surrounding the deprecated and newly replaced camera variable.

(You must be logged into your Github to view this link)

Pull Request Summary:

If the old and deprecated variable defaults to true in UE4 codebase, then the new replacement variable that serves the same role must also be set to true, to avoid breaking people’s code bases who are relying on the default value of the deprecated variable (I and everyone I know was relying on the default value set in UE4 code base, in CameraComponent.cpp ).

I hope this helps!

[FONT=Comic Sans MS]:heart:

PS: please see my post above for reference

Hi , thanks for looking at this.

I apologize for any issues this may have caused, but our intention really was to change the default behavior. There was a large consensus that the old default was not intuitive and was causing more harm than good. Also SpringArmComponent had a different default than CameraComponent (!) so we wanted them to share a common default behavior.

We tried to make the upgrade process as robust as possible but unfortunately other than try to communicate the changes required for existing C++ code we can’t do much more. Once you know about the issue it should be a simple fix. However, existing blueprints assets should have had the correct old value migrated automatically, regardless of the new default, because of the code in UCameraComponent::PostLoad() that loads old values and copies them to the new variable.

	bUsePawnControlRotation = bUseControllerViewRotation_DEPRECATED;


I’m also having the camera problem, i figured it out on my own that i had to turn on the Use Pawn Control Rotation option (Also set Camera->bUsePawnControlRotation = true; and Camera->bUseControllerViewRotation_DEPRECATED = true; in the code to be safe). After that it’s 95 % working, but when i look all down or all up it starts tripping :S Do you also have this problem? Just creating a fresh First or third Person Template and looking all the way down or up will also do the same thing, so it’s nothing specific to my project.