whenever I write 'SNew(SScaleBox)', packaging project cause assertion failed error

Whenever I write SNew(SScaleBox)’ in a slate class or UObject, packaging the project will cause assertion failed error, but it works fine on editor.

TSharedPtr<SScaleBox> A = SNew(SScaleBox);
TSharedRef<SScaleBox> B = SNew(SScaleBox);

ChildSlot
[
    SNew(SScaleBox)
    [
    ]
];

all of those 3 get the same error

UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: begin: stack for UAT
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: === Critical error: ===
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error:
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: Assertion failed: IsValid() [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Templates/SharedPointer.h] [Line: 879]
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error:
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error:
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error:
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffad656fdec KERNELBASE.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa32580216 UE4Editor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa32584218 UE4Editor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa322a242d UE4Editor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa321f6a45 UE4Editor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa321f80a0 UE4Editor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa317bc085 UE4Editor-Slate.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa3198eaa9 UE4Editor-Slate.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff9f3592016 UE4Editor-MyProject_4_27.dll!AMyCharacter::AMyCharacter() [E:\Unreal Projects\MyProject_4_27\Source\MyProject_4_27\Public\MyCharacter.h:32]
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa7a5761d3 UE4Editor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa7a898faf UE4Editor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa7a875411 UE4Editor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa7a73ddc5 UE4Editor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa322e1bea UE4Editor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffa323015a3 UE4Editor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffaaad56433 UE4Editor-Projects.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffaaad5674f UE4Editor-Projects.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff6cf3d5642 UE4Editor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff6cf3d9000 UE4Editor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff6cf3d0d2c UE4Editor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff6cf3d10ba UE4Editor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff6cf3d40dd UE4Editor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff6cf3e5984 UE4Editor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ff6cf3e78be UE4Editor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffad870269d KERNEL32.DLL!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: [Callstack] 0x00007ffad8faa9f8 ntdll.dll!UnknownFunction []
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error:
UATHelper: Packaging (Windows (64-bit)):   LogWindows: Error: end: stack for UAT

I have included ‘Slate’ and ‘SlateCore’ to Build.cs in both Private and Public dependencies
did I missed something?

I would advise you to use UUserWidget class instead. It’s newer.

I’m not sure about this but I think sooner or later SWidget will be deprecated.

AnyWay— try this

	PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });

	// Uncomment if you are using Slate UI
	PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

→ UMG

it is not working
I use Slate because it is lower level than UMG

Certainly missing a dynamic library:

KERNELBASE.dll!UnknownFunction

You are using UE4.27

MyProject_4_27

I tried Slate on UE5.1.1 and it works fine.

However, I think it is unnecessarily complicated.

I use blueprints only for the layout of graphical user interfaces and to redirect paths. And all the logic in C++. (BindWidget)

For example:

UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidget), Category=C++|UserWidget )
UButton *QuitGameButton;|

I think it’s having the best of both worlds!!

I tested on UE 4.27 and UE 5.1, both get the same error.
I found the UMG scale box also use SScaleBox, but it write SNew(SScaleBox) at RebuildWidget, I tried move the SNew(SScaleBox) to the variable at .h
TSharedPtr<SScaleBox> MyScaleBox; to TSharedPtr<SScaleBox> MyScaleBox = SNew(SScaleBox);
get the same error.

I also tried to use SNew(SScaleBox) at AActor default constructor, get the same error, but write it at BeginPlay doesn’t get the error.
This is very weird problem.

While, many other slates, like STextBlock, SBox, SImage, never get such error. So far, this only happen on SScaleBox.
But, somehow I managed to get it working, I create a child class of SScaleBox, the problem went away.

1 Like

I know one thing… Epic is continually making changes (too many changes)… a lot of things break between an old version and a new one. That’s why there are many people who are still using version 4.27 and haven’t made the jump to 5.1.1 yet.

When you change the version you should know that there are many things that are going to stop working and that you will have to update.

but…

That’s great!! You did it!!