Hey guys,
I've got a panel I'm using as a pop up window in my mobile app. I'm trying to use it as an all-purpose pop up and just change the text to match the reason the pop up appeared (confirmation to return to main menu, error messages, etc.). The pop up tweens from super tiny and alpha of 0 to regular size and alpha of 1. The problem is, if I change the text in the boxes as it tweens in, the text still assumes it's super tiny and doesn't show up correctly once the box has finished appearing.
Here's the code I'm using:
public void ShowPopUp (string reasonString)
{
popupPanelPopped = true;
// Make the popup visible
popupPanelTween.PlayForward();
popupBackgroundTween.PlayForward();
fadeTween.PlayForward();
// Customize text based on what called the pop up
if (reasonString == "xButtonPressed")
{
popupText.text = "End quiz and return to the Main Menu?";
popupButton1Sprite.enabled = true;
popupButton2Sprite.enabled = true;
popupButton1Label.text = "Main Menu";
popupButton2Label.text = "Cancel";
popupButton1Sprite.leftAnchor.relative = 0; // 0 = left, 1 = right
popupButton1Sprite.leftAnchor.absolute = 15;
popupButton1Sprite.rightAnchor.relative = 0.5f;
popupButton1Sprite.rightAnchor.absolute = -10;
popupButton1Sprite.ResetAndUpdateAnchors();
}
else if (reasonString == "quizInvalid")
{
popupText.text = "There are no cards that match the quiz options! Change options and try again.";
popupButton1Label.text = "Okay";
popupButton1Sprite.enabled = true;
popupButton2Sprite.enabled = false;
popupButton2Label.text = "";
popupButton1Sprite.leftAnchor.relative = 0; // 0 = left, 1 = right
popupButton1Sprite.leftAnchor.absolute = 89;
popupButton1Sprite.rightAnchor.relative = 1;
popupButton1Sprite.rightAnchor.absolute = -89;
popupButton1Sprite.ResetAndUpdateAnchors();
}
}
This code works fine as long as the text isn't changed, but if the pop up is called for one reason and then a different reason later, the text gets all screwed up. The moment I edit the text in the Inspector, it suddenly pops into the right size. In fact, even re-sizing the Game window fixes it, but that isn't really a solution

After some experimentation, adding a "ResetAndUpdateAnchors();" line for the buttons seems to fix this problem, however adding one for popupText.text does not help.
Any thoughts?