A change has been done to the TSoftObjectPtr class that warns when constructing a pointer-to non-const from a pointer-to-const. This change makes sense and is correct.
Example:
UTexture2D* LoadedTexture = LoadObject<UTexture2D>(nullptr, TEXT("/Game/Textures/MyTexture.MyTexture"));
TSoftObjectPtr<const UTexture2D> ConstTexturePtr = LoadedTexture;
// Warning occurs here
TSoftObjectPtr<UTexture2D> NonConstTexturePtr = ConstTexturePtr;
The issue comes when a TSoftObjectPtr<const type> is used inside a DynamicDelegate. The delegate would strip the const from the declaration.
This warning was done in 5.5, so it is a regression.
1- Create a C++ Unreal 5.5 project
2- Create any Unreal class, Object/Actor for example, and create a Dynamic delegate with a TSoftObjectPtr pointing to a const type as a parameter. Example:
DECLARE_DYNAMIC_DELEGATE_OneParam(FExampleDelegate, TSoftObjectPtr<const UObject>, Object);
3- Create a variable inside the class of the dynamic delegate type and compile. The following warning will appear:
Warning C4996 : 'TSoftObjectPtr<UObject>::TSoftObjectPtr': Constructing TSoftObjectPtr from an incompatible pointer type has been deprecated. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
I am not able to find world outliner how to enable it?
What method is used to fill polygonal regions when drawing spline mesh at run time?
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
Game Fort nite does not work after the last update
How to achieve HLSL Multiple Render Target in Material blueprints?
Delay nodes occasionally don't fire the "Completed" output in a nativized build
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-239493 in the post.
1 |
Component | UE - Foundation - Cpp Tools - UnrealHeaderTool |
---|---|
Affects Versions | 5.5 |
Target Fix | 5.6 |
Created | Jan 21, 2025 |
---|---|
Updated | Jan 29, 2025 |