Unity Version: 6000.0.21f1
Adventure Creator v1.81.7 (happened already in the previous version)
I have set my Subtitles Source to Unity Ui Prefab in order to be able to style them.
I have created a Speech Menu Placement Child for each of my characters and assigned it in the according slot.
In the AC settings under Menu, I have set the position type of Subtitles and even the conversation to "above speaking character".
I also set it to "Always fit within screen"
Sometimes (!) it is working as expected and nicely. But now and then all dialogue text is suddenly shown in the bottom left corner of the screen instead, and when the text is long enough, it is cropped at the screen border. I have only set up one conversation for now, so all of this happens with this same conversation.
When it happens, it happens all the time while the game is running. When it works, it also works all the time while the game is running. Sometimes I can restart the game mode a few times and it always works, sometimes I restart the game mode and it is always broken - without me having changed any settings for those subtitles. I don't see a pattern yet.
I have no idea why this happens and why it doesn't always happen. It feels like it happens randomly, so it is hard to say how one could reproduce this behaviour.
Posting this here, hoping someone else has experienced that as well before and there is a solution that works.
I was hoping that the recent AC update might help, and at first it looked fine, but then it happened again. There are no errors in the console. Have you ever experienced this and any idea what could be the reason why this happens/how to fix it?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Additional info:
Ok, now the change happened in the same game session: First the subtitles were positioned the wrong way (not above the speaker's head).
Then I left the scene through a door, came back - upon return the subtitles were positioned correctly above the head.
In this case it was subtitles from a cutscene which starts when opening the scene.
Even if the subtitles are positioned correctly though, they are cropped at the screen border. Maybe that is because I centered the text instead of having it left aligned? The "typewriter" default effect is enabled, as well as TextMeshPro features.
As there's trouble recreating this reliably, let's start by removing some of the additional aspects to reduce the complexity. Stick to just regular speech Actions (no Conversation objects), remove an enforced aspect ratio if set, and disable speech scrolling (the global setting, not just the Typewriter effect) for the moment.
Is this for a 2D or 3D game? If 2D, check that the speech placement child has a local Z position of zero, so that its depth from the camera matches that of the character.
AC will reposition Menus by affecting the "RectTransform boundary" object. This should be an intermediate object that's a child of the Canvas, but a parent of the visible elements, and whose size should span that of the content. Can you share screenshots of the Menu's properties, along with the UI prefab?
I had added a cutscene to the start of my game/scene with regular speech actions, which I am using now for testing this.
Here is the link for the three screenshots: https://imgur.com/a/ujKv9U4 (showing SpeechSettings, SubtitlesMenuSettings as well as the SubtitlesUI Prefab)
Something else I noticed yesterday: When the Unity editor was out of focus while the cutscene speech started, and I got it into focus again, the text jumped visibly from the bottom left corner to the head of the character where it belongs.
The same happened right now when I switched from the "Scene" to the "Game" tab in the editor while the cutscene was running (having them both next to each other filling the same center area in the editor, so I don't see their content at the same time)
Maybe this helps ...
I actually think now that it might actually be something about the game being out of focus. At least I was able to reproduce it right now that way.
The Auto Correct UI Dimensions component has its Transform to control field set to the Canvas root object - this should be instead left blank, so that it defaults to the Panel, i.e. the RectTransform boundary.
It'd be worth removing this component temporarily, again in the name of reducing complexity while we get to the bottom of things.
Check if this still occurs after removing the above component, and does this trick always move the menu to the correct position? Try instead slightly tweaking the size of the Game window - does that have the same effect?
The issue also happens when the Transform to control field is blank.
I can really reproduce it now by:
1. Clicking on the Scene Tab (so the Game Tab next to it is inactive)
2. Starting the Game Mode
3. Switching to Game Mode after the Start Cutscene with Dialogue has started
4. Now the text is displaced (in the bottom left corner).
And yes, when I resize the game window afterwards, the text moves to the correct position.
The same happens when I disable the Auto-correct UI Dimensions component.
Thanks for the steps, I'll attempt a recreation.
Recreated, thanks.
Open up AC's PlayerMenus script, and add the following function:
Very cool! Thank you very much for checking this and finding a solution so quickly.
I tried it and the solution works. I had to add it inside the
public class PlayerMenus : MonoBehaviour
{ }
inside the script you mentioned to make it work. Just in case anyone else wants to fix this as well.