Forum rules - please read before posting.

Indentation of multi-line conversation options.

edited August 2020 in Technical Q&A

Hi

I'm wondering how to achieve the effect seen in the image in this link:

https://imgur.com/yAD1NZn
(forum image embedding function doesn't seem to work right now)

In words: I want to indent the extra lines in multi-line options in a conversation menu.
I guess it sounds like a question for the Unity Forums, but since I'm using the "Prefix with index numbers" feature in AC, I'm thinking there could be some lind of built in indentation feature also....?

Comments

  • The Prefix with index numbers? option simply adds the number values to the front of the text. Indentation isn't something that the text value itself can do - you'd have to implement this on the UI end of things.

    With a Unity UI-based menu, you'll need to make each number prefix a separate UI Text component - not linked to AC's Menu Manager - so that the option lines themselves are just left-aligned as normal.

    What you can then do is attach a script to the base of the Unity UI that reads the number of options in the active Conversation, and only shows that many of the ordinal number Text components, i.e.:

    using UnityEngine;
    using UnityEngine.UI;
    using AC;
    
    public class OrdinalConversationNumbers : MonoBehaviour
    {
    
        public Text[] ordinalTexts;
    
        void OnEnable ()
        {
            if (KickStarter.playerInput == null) return;
            if (ordinalTexts == null) return;
    
            Conversation activeConversation = KickStarter.playerInput.activeConversation;
            if (activeConversation == null) return;
    
            int numOptions = activeConversation.GetNumEnabledOptions ();
            for (int i=0; i<ordinalTexts.Length; i++)
            {
                ordinalTexts[i].enabled = (i < numOptions);
            }
        }
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.