From c2053e88d9a8cb462760f4ad7d9054cac7e377e2 Mon Sep 17 00:00:00 2001 From: Antonis Makropoulos Date: Fri, 12 Jan 2024 11:10:35 +0200 Subject: [PATCH 1/3] fix scale to 1 in elements --- Samples~/ChatBot/Bubble.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Samples~/ChatBot/Bubble.cs b/Samples~/ChatBot/Bubble.cs index bb808b0e..1523b55d 100644 --- a/Samples~/ChatBot/Bubble.cs +++ b/Samples~/ChatBot/Bubble.cs @@ -78,6 +78,7 @@ void SetBubblePosition(RectTransform bubbleRectTransform, RectTransform imageRec bubbleRectTransform.pivot = new Vector2(bubbleUI.leftPosition, bubbleUI.bottomPosition); bubbleRectTransform.anchorMin = new Vector2(bubbleUI.leftPosition, bubbleUI.bottomPosition); bubbleRectTransform.anchorMax = new Vector2(bubbleUI.leftPosition, bubbleUI.bottomPosition); + bubbleRectTransform.localScale = Vector3.one; Vector2 anchoredPosition = new Vector2(bubbleUI.bubbleOffset + bubbleUI.textPadding, bubbleUI.bubbleOffset + bubbleUI.textPadding); if (bubbleUI.leftPosition == 1) anchoredPosition.x *= -1; if (bubbleUI.bottomPosition == 1) anchoredPosition.y *= -1; @@ -156,6 +157,7 @@ GameObject CreatePlaceholderObject(Transform parent, RectTransform textRectTrans RectTransform placeholderRectTransform = placeholderObject.GetComponent(); placeholderRectTransform.sizeDelta = textRectTransform.sizeDelta; placeholderRectTransform.anchoredPosition = textRectTransform.anchoredPosition; + placeholderRectTransform.localScale = Vector3.one; SyncParentRectTransform(placeholderRectTransform); return placeholderObject; } @@ -170,7 +172,9 @@ GameObject CreateInputFieldObject(Transform parent, Text textObject, Text placeh inputField.lineType = InputField.LineType.MultiLineSubmit; inputField.shouldHideMobileInput = false; inputField.shouldActivateOnSelect = true; - SyncParentRectTransform(inputFieldObject.GetComponent()); + RectTransform inputFieldRect = inputFieldObject.GetComponent(); + inputFieldRect.localScale = Vector3.one; + SyncParentRectTransform(inputFieldRect); return inputFieldObject; } From a3a919141dd36b914601d03701655e3d79b9222a Mon Sep 17 00:00:00 2001 From: Antonis Makropoulos Date: Fri, 12 Jan 2024 11:11:08 +0200 Subject: [PATCH 2/3] modify anchoredPosition instead of position --- Samples~/ChatBot/ChatBot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples~/ChatBot/ChatBot.cs b/Samples~/ChatBot/ChatBot.cs index 8f46b708..23daf6a2 100644 --- a/Samples~/ChatBot/ChatBot.cs +++ b/Samples~/ChatBot/ChatBot.cs @@ -116,7 +116,7 @@ public void UpdateBubblePositions() for (int i = chatBubbles.Count - 1; i >= 0; i--) { Bubble bubble = chatBubbles[i]; RectTransform childRect = bubble.GetRectTransform(); - childRect.position = new Vector2(childRect.position.x, y); + childRect.anchoredPosition = new Vector2(childRect.anchoredPosition.x, y); // last bubble outside the container if (y > containerHeight && lastBubbleOutsideFOV == -1){ From e224d377a84e432436789ab5c418c28e5e64355c Mon Sep 17 00:00:00 2001 From: Antonis Makropoulos Date: Fri, 12 Jan 2024 11:12:20 +0200 Subject: [PATCH 3/3] increase bubble width and font size --- Samples~/ChatBot/Scene.unity | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Samples~/ChatBot/Scene.unity b/Samples~/ChatBot/Scene.unity index bac6b516..cea98ca6 100644 --- a/Samples~/ChatBot/Scene.unity +++ b/Samples~/ChatBot/Scene.unity @@ -176,8 +176,8 @@ MonoBehaviour: aiColor: {r: 0.11372549, g: 0.11372549, b: 0.28627452, a: 1} fontColor: {r: 1, g: 1, b: 1, a: 1} font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - fontSize: 16 - bubbleWidth: 450 + fontSize: 20 + bubbleWidth: 600 llm: {fileID: 817827756} textPadding: 10 bubbleSpacing: 10