# Is there any way to deep copy/clone Widget?

**URL:** <https://forums.unrealengine.com/t/is-there-any-way-to-deep-copy-clone-widget/477793>\
**Category:** UI\
**Tags:** duplicate, unreal-engine, Widget, CPP, question\
**Created:** [January 26, 2021, 8:45am UTC](https://forums.unrealengine.com/t/is-there-any-way-to-deep-copy-clone-widget/477793 "2021-01-26T08:45:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Exelim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Exelim](https://forums.unrealengine.com/u/Exelim)\
**Post date:** [January 26, 2021, 8:45am UTC](https://forums.unrealengine.com/t/is-there-any-way-to-deep-copy-clone-widget/477793/1 "2021-01-26T08:45:03Z")

</div>

Hi, I’m trying to build something like a dialogue system and I need to show a different amount of buttons in different dialogues. So I’ve created a dialogue Widget with a button inside and with the textblock inside button, then a want to duplicate this button and set text for each answer. Here is the code:

```
for(const auto& button : _buttons)
	{
		UButton* newButton = NewObject<UButton>(m_buttonTemplate);
		newButton = DuplicateObject(m_buttonTemplate, newButton);
		m_buttonsContainer->AddChildToVerticalBox(newButton);

		if(UTextBlock* text = Cast<UTextBlock>(newButton->GetChildAt(0)))
			text->SetText(FText::FromString(button.answerText));
	}

```

But the problem is that UTextBlock points to the same object ( like DuplicateObject function make a shallow copy not a deep) so all the buttons in the end has the same text.

Is there any way to do what I want?

Thanks!
