Example #1
0
    private IEnumerator DoAddToDialogText(string speaker, string text, TextAlignmentOptions align)
    {
        DialogPiece p = Instantiate(dialogObject);

        p.SetAlignment(align);
        p.SetText(speaker, text);
        yield return(null);

        p.transform.SetParent(conversationHolder);
        p.transform.SetSiblingIndex(conversationHolder.childCount - 2);
        p.transform.localScale = Vector3.one;
        yield return(null);

        conversationScroll.value = 0;
        yield return(null);

        conversationScroll.value = 0;
    }
    private IEnumerator DoAddToDialogText(string speaker, string text, TextAlignmentOptions align)
    {
        DialogPiece p = Instantiate(dialogObject);

        p.SetAlignment(align);
        p.SetText(speaker, text);
        yield return(null);

        p.transform.SetParent(conversationHolder);
        //Set this as almost but not quite the last element, since we always want the spacer to be the last
        //Without the spacer, the text winds up too close to the bottom of the screen and is hard to read
        p.transform.SetSiblingIndex(conversationHolder.childCount - 2);
        p.transform.localScale = Vector3.one;

        //I don't know why I need to do this twice, but it seems to work better this way?
        yield return(null);

        conversationScroll.value = 0;
        yield return(null);

        conversationScroll.value = 0;
    }