Forum rules - please read before posting.

Gather Text query

If gather text searching all the scenes for AC text and labels etc or textmeshpro and Unity UI text, will the gather text work on Doozy UI or Better UI if using only textmeshpro with these UI plugins? Any help is greatly appreciated, thanks.

Comments

  • When it comes to UI text, AC will refer to the elements within the Menu Manager rather than the UI components themselves.

    For text within the scene (Hotspot labels, etc), AC does a sweep for classes that implements ITranslatable. If you want to gather custom text for inclusion in the Speech Manager, you'll need to attach such a script.

    See the Manual's "Custom translatables" chapter, as well as the commented ITranslatable.cs script, for details.

    As an example, this script can be attached to a TextMeshPro UI Text box in the scene, allowing it to be included:

    using UnityEngine;
    using TMPro;
    using AC;
    
    public class CustomTMProTranslatable : MonoBehaviour, ITranslatable
    {
    
        public TextMeshProUGUI textBox;
        public int recordedLineID = -1;
    
    
        public string GetTranslatableString (int index)
        {
            return textBox.text;
        }
    
        public int GetTranslationID (int index)
        {
            return recordedLineID;
        }
    
    
        #if UNITY_EDITOR
    
        public void UpdateTranslatableString (int index, string updatedText)
        {
            textBox.text = updatedText;
        }
    
        public int GetNumTranslatables ()
        {
            return 1;
        }
    
        public bool CanTranslate (int index)
        {
            return textBox && !string.IsNullOrEmpty (textBox.text);
        }
    
        public bool HasExistingTranslation (int index)
        {
            return recordedLineID >= -1;
        }
    
        public void SetTranslationID (int index, int lineID)
        {
            recordedLineID = lineID;
            UnityEditor.EditorUtility.SetDirty (this);
        }
    
        public string GetOwner (int index)
        {
            return string.Empty;
        }
    
        public bool OwnerIsPlayer (int index)
        {
            return false;
        }
    
        public AC_TextType GetTranslationType (int index)
        {
            return AC_TextType.MenuElement;
        }
    
        #endif
    
    }
    
  • Thanks Chris I really appreciate the help.

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.