Hi everyone!
i need to create a custom button during runtime, and when clicked, i want its style to change. The probelm is that when i click it, only the style of the latest button is changing. I think this is due to MyButton being a reference to the latest created buttons SButton, but i dont know how to do anything about this. I did try storing a reference to the old SButtons, but MyButton starts as null, and setting it after its not null caused the same issue. If anyone has any ideas, or any tutorials on creating custom buttons in c++, please share!
void URankButton::ApplyReplay()
{
m_Leaderboard->SetCurrentRank(m_Rank);
if (Button.IsValid())
{
Button.Get()->SetButtonStyle(&m_Selected);
}
}
URankButton* rankDisplayButton = WidgetTree->ConstructWidget<URankButton>
(
URankButton::StaticClass(),
FName("Button" + World + FString::FromInt(RankInfo.Index))
);
rankDisplayButton->m_Normal = m_UnselctedButton;
rankDisplayButton->SetStyle(m_UnselctedButton);
rankDisplayButton->m_Selected = m_RankButtonStyle;