Skip to content

Fix scaling scenes in samples #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Samples~/ChatBot/Bubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ void SetBubblePosition(RectTransform bubbleRectTransform, RectTransform imageRec
if (bubbleUI.bottomPosition == 1) anchoredPosition.y *= -1;
bubbleRectTransform.anchoredPosition = anchoredPosition;

bubbleRectTransform.sizeDelta = new Vector2(600 - 2*bubbleUI.textPadding, bubbleRectTransform.sizeDelta.y - 2*bubbleUI.textPadding);
float width = bubbleUI.bubbleWidth == -1? bubbleRectTransform.sizeDelta.x: bubbleUI.bubbleWidth;
float height = bubbleUI.bubbleHeight == -1? bubbleRectTransform.sizeDelta.y: bubbleUI.bubbleHeight;
bubbleRectTransform.sizeDelta = new Vector2(width-2*bubbleUI.textPadding, height-2*bubbleUI.textPadding);
SyncParentRectTransform(imageRectTransform);
imageRectTransform.offsetMin = new Vector2(-bubbleUI.textPadding, -bubbleUI.textPadding);
imageRectTransform.offsetMax = new Vector2(bubbleUI.textPadding, bubbleUI.textPadding);
Expand Down
1 change: 0 additions & 1 deletion Samples~/ChatBot/ChatBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using LLMUnity;
using TMPro;

namespace LLMUnitySamples
{
Expand Down
7 changes: 4 additions & 3 deletions Samples~/ChatBot/Scene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ MonoBehaviour:
fontColor: {r: 1, g: 1, b: 1, a: 1}
font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
fontSize: 16
bubbleWidth: 600
bubbleWidth: 450
llm: {fileID: 817827756}
textPadding: 10
bubbleSpacing: 10
Expand Down Expand Up @@ -444,6 +444,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a50e3140c3ecaaf1c848dbf141cc2074, type: 3}
m_Name:
m_EditorClassIdentifier:
advancedOptions: 0
host: localhost
port: 13333
stream: 1
Expand Down Expand Up @@ -834,10 +835,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1550, y: 600}
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 1
m_PhysicalUnit: 3
Expand Down
46 changes: 24 additions & 22 deletions Samples~/ServerClient/Scene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
Expand Down Expand Up @@ -661,7 +661,7 @@ GameObject:
- component: {fileID: 856480604}
- component: {fileID: 856480603}
m_Layer: 5
m_Name: Text (Legacy)
m_Name: Player title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -683,7 +683,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 21.000015, y: 150}
m_AnchoredPosition: {x: 0, y: 160}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &856480603
Expand Down Expand Up @@ -926,7 +926,7 @@ GameObject:
- component: {fileID: 921839200}
- component: {fileID: 921839199}
m_Layer: 5
m_Name: AIImage2
m_Name: AI 2 Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -947,10 +947,10 @@ RectTransform:
- {fileID: 728022959}
m_Father: {fileID: 158550917}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 249, y: -110.69}
m_SizeDelta: {x: -781.57996, y: -493.27884}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 200, y: -110}
m_SizeDelta: {x: 350, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &921839199
MonoBehaviour:
Expand Down Expand Up @@ -1027,8 +1027,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 249, y: 87.002}
m_SizeDelta: {x: 294.42, y: 95.9957}
m_AnchoredPosition: {x: 200, y: 90}
m_SizeDelta: {x: 350, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &954556175
MonoBehaviour:
Expand Down Expand Up @@ -1215,6 +1215,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a50e3140c3ecaaf1c848dbf141cc2074, type: 3}
m_Name:
m_EditorClassIdentifier:
advancedOptions: 0
host: localhost
port: 13333
stream: 1
Expand Down Expand Up @@ -1344,7 +1345,7 @@ GameObject:
- component: {fileID: 1342801407}
- component: {fileID: 1342801406}
m_Layer: 5
m_Name: Text (Legacy) (1)
m_Name: AI 1 title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -1366,7 +1367,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -213, y: -46.061}
m_AnchoredPosition: {x: -200, y: -45}
m_SizeDelta: {x: 160, y: 29.6652}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1342801406
Expand Down Expand Up @@ -1423,7 +1424,7 @@ GameObject:
- component: {fileID: 1448762427}
- component: {fileID: 1448762426}
m_Layer: 5
m_Name: Text (Legacy) (2)
m_Name: AI 2 title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -1445,7 +1446,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 249, y: -45.997}
m_AnchoredPosition: {x: 200, y: -45}
m_SizeDelta: {x: 160, y: 29.6652}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1448762426
Expand Down Expand Up @@ -1519,6 +1520,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e95e88cdd1b0a159692667660a065473, type: 3}
m_Name:
m_EditorClassIdentifier:
advancedOptions: 0
host: localhost
port: 13333
stream: 1
Expand Down Expand Up @@ -1663,8 +1665,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -206.21, y: 87.002}
m_SizeDelta: {x: 294.42, y: 95.9957}
m_AnchoredPosition: {x: -200, y: 90}
m_SizeDelta: {x: 350, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1966107897
MonoBehaviour:
Expand Down Expand Up @@ -1852,7 +1854,7 @@ GameObject:
- component: {fileID: 2091685449}
- component: {fileID: 2091685448}
m_Layer: 5
m_Name: AIImage1
m_Name: AI 1 Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -1873,10 +1875,10 @@ RectTransform:
- {fileID: 887085509}
m_Father: {fileID: 158550917}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -206.21002, y: -110.75391}
m_SizeDelta: {x: -781.57996, y: -493.27884}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -200, y: -110}
m_SizeDelta: {x: 350, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2091685448
MonoBehaviour:
Expand Down
19 changes: 10 additions & 9 deletions Samples~/SimpleInteraction/Scene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
Expand Down Expand Up @@ -455,7 +455,7 @@ GameObject:
- component: {fileID: 856480604}
- component: {fileID: 856480603}
m_Layer: 5
m_Name: Text (Legacy)
m_Name: Player title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -737,6 +737,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a50e3140c3ecaaf1c848dbf141cc2074, type: 3}
m_Name:
m_EditorClassIdentifier:
advancedOptions: 0
host: localhost
port: 13333
stream: 1
Expand Down Expand Up @@ -866,7 +867,7 @@ GameObject:
- component: {fileID: 1342801407}
- component: {fileID: 1342801406}
m_Layer: 5
m_Name: Text (Legacy) (1)
m_Name: AI title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -1049,8 +1050,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 10.375999, y: 87.00699}
m_SizeDelta: {x: 294.42, y: 95.9957}
m_AnchoredPosition: {x: 10.375977, y: 87.00699}
m_SizeDelta: {x: 400, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1966107897
MonoBehaviour:
Expand Down Expand Up @@ -1259,10 +1260,10 @@ RectTransform:
- {fileID: 887085509}
m_Father: {fileID: 158550917}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 10.375977, y: -110.75391}
m_SizeDelta: {x: -781.57996, y: -493.27884}
m_SizeDelta: {x: 400, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2091685448
MonoBehaviour:
Expand Down