private IEnumerator RevealFinish() { yield return(new WaitForEndOfFrame()); var optionWidthMax = 0.0f; foreach (var option in m_optionList) { optionWidthMax = Mathf.Max(option.GetComponent <TextMeshPro>().renderedWidth, optionWidthMax); Debug.Log("Width max: " + optionWidthMax); } var optionHeight = m_optionList[0].GetComponent <TextMeshPro>().renderedHeight; var windowWidth = optionWidthMax + m_optionsTextMargin.x * 2.0f; var insideHeight = (optionHeight + m_optionsTextVerticalSpacing) * m_optionList.Count; var windowHeight = insideHeight + m_optionsTextMargin.y * 2.0f; var targetSize = new Vector2(windowWidth, windowHeight); Debug.Log("Background size: " + m_optionsBackground.size); var x = m_optionsBackground.transform.position.x; var y = m_optionsBackground.transform.position.y + insideHeight / 2.0f - optionHeight / 2.0f; foreach (var option in m_optionList) { option.transform.position = new Vector2(x, y); y -= optionHeight + m_optionsTextVerticalSpacing; } // lerp the window size var timeElapsed = 0.0f; while (timeElapsed < m_optionsDisplayLerpTime) { m_optionsBackground.size = Vector2.Lerp(Vector2.zero, targetSize, timeElapsed / m_optionsDisplayLerpTime); timeElapsed += Time.deltaTime; yield return(null); } // set up the cursor if (m_menuCursor == null) { Debug.LogErrorFormat("Cannot show options in {0} without a menu cursor set.", name); yield break; } m_menuCursor.SetOptions(m_optionList); m_menuCursor.CurIndex = 0; // reveal options and cursor foreach (var option in m_optionList) { option.GetComponent <TextMeshPro>().color = Color.white; } m_menuCursor.GetComponent <SpriteRenderer>().color = Color.white; m_menuCursor.enabled = true; }