# Custom colorpicker packing error. Stack for UTA. in 4.21

**URL:** <https://forums.unrealengine.com/t/custom-colorpicker-packing-error-stack-for-uta-in-4-21/444383>\
**Category:** C++\
**Tags:** color-picker, unreal-engine, UE4, question, CPP\
**Created:** [March 1, 2019, 8:44am UTC](https://forums.unrealengine.com/t/custom-colorpicker-packing-error-stack-for-uta-in-4-21/444383 "2019-03-01T08:44:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seven\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Seven\_1](https://forums.unrealengine.com/u/Seven_1)\
**Post date:** [March 1, 2019, 8:44am UTC](https://forums.unrealengine.com/t/custom-colorpicker-packing-error-stack-for-uta-in-4-21/444383/1 "2019-03-01T08:44:33Z")

</div>

.h  
#include “CoreMinimal.h”  
#include “Components/NativeWidgetHost.h”  
#include “ColorPickerTest.generated.h”

```
class SColorPicker;

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FColorPickerColorChangedDelegate, const FLinearColor&, new_color);

UCLASS()
class MULTIUSERVIEWER2_API UColorPickerTest : public UNativeWidgetHost
{
	GENERATED_BODY()
	
public:
	UColorPickerTest(const FObjectInitializer& ObjectInitializer);

	UFUNCTION(BlueprintCallable, Category = "custom_UMG")
		void SetInitialColor(const FLinearColor initial_color);

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
		FLinearColor selected_color_rgb_;

	UPROPERTY(BlueprintAssignable, Category = "custom_UMG")
		FColorPickerColorChangedDelegate ColorPickerColorChangedDelegate;

private:
	TSharedPtr<SColorPicker> color_picker_;

	void GenerateColorPicker(const FLinearColor& initial_color);
};

```

.cpp  
#include “ColorPickerTest.h”

```
#include "Runtime/AppFramework/Public/Widgets/Colors/SColorPicker.h"
#include "Kismet/KismetMathLibrary.h"

UColorPickerTest::UColorPickerTest(const FObjectInitializer& ObjectInitializer) : UNativeWidgetHost(ObjectInitializer), selected_color_rgb_(FLinearColor::White) 
{
	GenerateColorPicker(selected_color_rgb_);
}

void UColorPickerTest::SetInitialColor(const FLinearColor initial_color) 
{
	GenerateColorPicker(initial_color);
	//color_picker_->SetColorRGB(initial_color);
}

void UColorPickerTest::GenerateColorPicker(const FLinearColor& initial_color)
{
	Super::ReleaseSlateResources(/*bReleaseChildren = */true);
	if (color_picker_.IsValid()) 
	{
		color_picker_.Reset();
	}

	selected_color_rgb_ = initial_color;
	SAssignNew(color_picker_, SColorPicker)
		.TargetColorAttribute(selected_color_rgb_)
		.OnColorCommitted_Lambda([this](FLinearColor changed_color)
	{
		selected_color_rgb_ = changed_color;
		if (ColorPickerColorChangedDelegate.IsBound())
		{
			ColorPickerColorChangedDelegate.Broadcast(changed_color);
		}
	})
		.ExpandAdvancedSection(true)
		.UseAlpha(false)
		.sRGBOverride(true);

	SetContent(color_picker_.ToSharedRef());
}

```

packing error： Stack for UTA.
