Howdy,
The customisation questions doth continue!
In my original design I want to handle dialogue in two different ways when it comes to rendering:
- Dialogue from the player (things they say) and conversation choices they choose are on a 2D UI
- Dialogue and lines from any NPCs appear in 3D world space above the character in question
Could someone please give me some pointers as to how this would be workable alongside AC? My research so far has started to point towards switching over to use "Unity UI in scene" in various menus such as subtitles. So far I've managed to get the default subtitles to output to a Unity Canvas linked to different text objects so I think I'm starting to understand how you target AC bits at UI things.
In my original LD project I had a TextMeshPro object above the NPCs and fed the string into the text object. Could the same thing work here?
Thanks!
Tem
Comments
I've got the subtitle menu configuration for certain chracters working, so that's great (well, one for the player and then 'all except specific characters'). Seems to do the job! Another really useful feature.
There is a point there which says:
Each label you want to replace with TMPro will need both a Unity UI Text component, and a Text Mesh Pro UGUI component. The Text component can be hidden or given an invisible colour, but should not be disabled.
I'm interpreting that as I need a gameobject with both those components on. However in Unity I'm unable to add a dummy text component to a text mesh pro object:
Where abouts am I going wrong in this process?
I tried accessing things like:
public class test : MonoBehaviour { MenuLabel testText; void Update () { testText = AC.PlayerMenus.GetElementWithName("SubtitlesNPC", "SubsSpeakerLabel") as AC.MenuLabel; print(testText.label); print(testText.title); print(testText.uiText); } }
My idea was to query what was coming through the element, but during runtime I was only getting output like 'null' 'brain'...not the dialgoue text I was seeing on the screen which uses that element.I'm thinking if I can just access the current string then I can hook up the text mesh pro stuff in my own way.
I've also just become aware of EventManager.OnStartSpeech as a means to access conversation data as it occurs.
I think with those tools that ought to keep me occupied for a while.
AC.EventManager.OnStartSpeech
In my case I went ahead and:
• Made a child gameObject for my NPC
• The child gameObject is just a TextMeshPro 3D object
• Added a script to the main NPC parent object
• The script has a reference to the TextMeshPro object & the NPC itself
EventManager.OnStartSpeech
Char speakingCharacter
) matches the NPC reference.• If so (which means the script is attached to the NPC who should be talking), it sets the TextMeshPro object .text to equal speechText
There might be better ways to do it, but this appears to work for now and it means I haven't had to dabble with Unity canvases or create new menus...etc