Skip to content

Commit bcb77dd

Browse files
committed
UI scaling, video pausing on form visible, close button
1 parent 23172f2 commit bcb77dd

File tree

6 files changed

+466
-48
lines changed

6 files changed

+466
-48
lines changed

Runtime/BH_CoroutineUtils.cs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
using UnityEngine;
2+
using System.Collections;
3+
using System;
4+
5+
// Adapted from https://jacksondunstan.com/articles/3718
6+
public static class BH_CoroutineUtils
7+
{
8+
// Calls a coroutine but if there's an error in that coroutine, it'll log the error & return
9+
// instead of just killing the caller.
10+
//
11+
// Call it like this:
12+
//
13+
// yield return CoroutineUtils.Try(MyCoroutine());
14+
//
15+
public static IEnumerator Try(IEnumerator enumerator)
16+
{
17+
while (true)
18+
{
19+
object current;
20+
try
21+
{
22+
if (enumerator.MoveNext() == false)
23+
{
24+
break;
25+
}
26+
current = enumerator.Current;
27+
}
28+
catch (Exception ex)
29+
{
30+
Debug.LogError(ex);
31+
yield break;
32+
}
33+
yield return current;
34+
}
35+
}
36+
37+
// Use this function if you want to start a coroutine and add your own error handling behavior.
38+
//
39+
// For example:
40+
//
41+
// CoroutineUtils.StartThrowingCoroutine(
42+
// this,
43+
// MyCoroutine(),
44+
// (ex) => {
45+
// if (ex == null)
46+
// Debug.Log("coroutine completed successfully!");
47+
// else
48+
// Debug.Log("Houson, we have a problem: " + ex);
49+
// }
50+
// );
51+
//
52+
public static Coroutine StartThrowingCoroutine(
53+
MonoBehaviour monoBehaviour,
54+
IEnumerator enumerator,
55+
Action<Exception> done)
56+
{
57+
return monoBehaviour.StartCoroutine(RunThrowingIterator(enumerator, done));
58+
}
59+
60+
public static IEnumerator RunThrowingIterator(
61+
IEnumerator enumerator,
62+
Action<Exception> done)
63+
{
64+
while (true)
65+
{
66+
object current;
67+
try
68+
{
69+
if (enumerator.MoveNext() == false)
70+
{
71+
break;
72+
}
73+
current = enumerator.Current;
74+
}
75+
catch (Exception ex)
76+
{
77+
Debug.LogError(ex);
78+
done?.Invoke(ex);
79+
yield break;
80+
}
81+
yield return current;
82+
}
83+
done?.Invoke(null);
84+
}
85+
}

Runtime/BH_CoroutineUtils.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Prefabs/BugReportingFormCanvas.prefab

Lines changed: 260 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,140 @@
11
%YAML 1.1
22
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!1 &2441839802222076037
4+
GameObject:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
serializedVersion: 6
10+
m_Component:
11+
- component: {fileID: 7386148524240149116}
12+
- component: {fileID: 4397047446947554102}
13+
- component: {fileID: 6903971468282260231}
14+
m_Layer: 5
15+
m_Name: Text (TMP)
16+
m_TagString: Untagged
17+
m_Icon: {fileID: 0}
18+
m_NavMeshLayer: 0
19+
m_StaticEditorFlags: 0
20+
m_IsActive: 1
21+
--- !u!224 &7386148524240149116
22+
RectTransform:
23+
m_ObjectHideFlags: 0
24+
m_CorrespondingSourceObject: {fileID: 0}
25+
m_PrefabInstance: {fileID: 0}
26+
m_PrefabAsset: {fileID: 0}
27+
m_GameObject: {fileID: 2441839802222076037}
28+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
29+
m_LocalPosition: {x: 0, y: 0, z: 0}
30+
m_LocalScale: {x: 1, y: 1, z: 1}
31+
m_ConstrainProportionsScale: 0
32+
m_Children: []
33+
m_Father: {fileID: 1741720219296545283}
34+
m_RootOrder: 0
35+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
36+
m_AnchorMin: {x: 0, y: 0}
37+
m_AnchorMax: {x: 1, y: 1}
38+
m_AnchoredPosition: {x: 0, y: 0}
39+
m_SizeDelta: {x: 0, y: 0}
40+
m_Pivot: {x: 0.5, y: 0.5}
41+
--- !u!222 &4397047446947554102
42+
CanvasRenderer:
43+
m_ObjectHideFlags: 0
44+
m_CorrespondingSourceObject: {fileID: 0}
45+
m_PrefabInstance: {fileID: 0}
46+
m_PrefabAsset: {fileID: 0}
47+
m_GameObject: {fileID: 2441839802222076037}
48+
m_CullTransparentMesh: 1
49+
--- !u!114 &6903971468282260231
50+
MonoBehaviour:
51+
m_ObjectHideFlags: 0
52+
m_CorrespondingSourceObject: {fileID: 0}
53+
m_PrefabInstance: {fileID: 0}
54+
m_PrefabAsset: {fileID: 0}
55+
m_GameObject: {fileID: 2441839802222076037}
56+
m_Enabled: 1
57+
m_EditorHideFlags: 0
58+
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
59+
m_Name:
60+
m_EditorClassIdentifier:
61+
m_Material: {fileID: 0}
62+
m_Color: {r: 1, g: 1, b: 1, a: 1}
63+
m_RaycastTarget: 1
64+
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
65+
m_Maskable: 1
66+
m_OnCullStateChanged:
67+
m_PersistentCalls:
68+
m_Calls: []
69+
m_text: X
70+
m_isRightToLeft: 0
71+
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
72+
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
73+
m_fontSharedMaterials: []
74+
m_fontMaterial: {fileID: 0}
75+
m_fontMaterials: []
76+
m_fontColor32:
77+
serializedVersion: 2
78+
rgba: 4281479730
79+
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
80+
m_enableVertexGradient: 0
81+
m_colorMode: 3
82+
m_fontColorGradient:
83+
topLeft: {r: 1, g: 1, b: 1, a: 1}
84+
topRight: {r: 1, g: 1, b: 1, a: 1}
85+
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
86+
bottomRight: {r: 1, g: 1, b: 1, a: 1}
87+
m_fontColorGradientPreset: {fileID: 0}
88+
m_spriteAsset: {fileID: 0}
89+
m_tintAllSprites: 0
90+
m_StyleSheet: {fileID: 0}
91+
m_TextStyleHashCode: -1183493901
92+
m_overrideHtmlColors: 0
93+
m_faceColor:
94+
serializedVersion: 2
95+
rgba: 4294967295
96+
m_fontSize: 24
97+
m_fontSizeBase: 24
98+
m_fontWeight: 400
99+
m_enableAutoSizing: 0
100+
m_fontSizeMin: 18
101+
m_fontSizeMax: 72
102+
m_fontStyle: 0
103+
m_HorizontalAlignment: 2
104+
m_VerticalAlignment: 512
105+
m_textAlignment: 65535
106+
m_characterSpacing: 0
107+
m_wordSpacing: 0
108+
m_lineSpacing: 0
109+
m_lineSpacingMax: 0
110+
m_paragraphSpacing: 0
111+
m_charWidthMaxAdj: 0
112+
m_enableWordWrapping: 1
113+
m_wordWrappingRatios: 0.4
114+
m_overflowMode: 0
115+
m_linkedTextComponent: {fileID: 0}
116+
parentLinkedComponent: {fileID: 0}
117+
m_enableKerning: 1
118+
m_enableExtraPadding: 0
119+
checkPaddingRequired: 0
120+
m_isRichText: 1
121+
m_parseCtrlCharacters: 1
122+
m_isOrthographic: 1
123+
m_isCullingEnabled: 0
124+
m_horizontalMapping: 0
125+
m_verticalMapping: 0
126+
m_uvLineOffset: 0
127+
m_geometrySortingOrder: 0
128+
m_IsTextObjectScaleStatic: 0
129+
m_VertexBufferAutoSizeReduction: 0
130+
m_useMaxVisibleDescender: 1
131+
m_pageToDisplay: 1
132+
m_margin: {x: 0, y: 0, z: 0, w: 0}
133+
m_isUsingLegacyAnimationComponent: 0
134+
m_isVolumetricText: 0
135+
m_hasFontAssetChanged: 0
136+
m_baseMaterial: {fileID: 0}
137+
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
3138
--- !u!1 &3630024247434959499
4139
GameObject:
5140
m_ObjectHideFlags: 0
@@ -479,7 +614,7 @@ Canvas:
479614
m_VertexColorAlwaysGammaSpace: 0
480615
m_AdditionalShaderChannelsFlag: 25
481616
m_SortingLayerID: 0
482-
m_SortingOrder: 0
617+
m_SortingOrder: 32767
483618
m_TargetDisplay: 0
484619
--- !u!114 &3630024247677609245
485620
MonoBehaviour:
@@ -537,6 +672,7 @@ MonoBehaviour:
537672
descriptionField: {fileID: 3630024249523897025}
538673
stepsField: {fileID: 3630024249440770398}
539674
submitButton: {fileID: 3630024248266512409}
675+
closeButton: {fileID: 6839878271182632936}
540676
messagePanel: {fileID: 3630024248915368460}
541677
messagePanelUI: {fileID: 3630024248915368456}
542678
submitEndpoint: https://app.betahub.io
@@ -1769,6 +1905,7 @@ RectTransform:
17691905
- {fileID: 3630024249440770397}
17701906
- {fileID: 3630024248266512410}
17711907
- {fileID: 3630024248335619514}
1908+
- {fileID: 1741720219296545283}
17721909
m_Father: {fileID: 3630024247677609247}
17731910
m_RootOrder: 0
17741911
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -2572,3 +2709,125 @@ MonoBehaviour:
25722709
m_isRichTextEditingAllowed: 0
25732710
m_LineLimit: 0
25742711
m_InputValidator: {fileID: 0}
2712+
--- !u!1 &4723286903512921305
2713+
GameObject:
2714+
m_ObjectHideFlags: 0
2715+
m_CorrespondingSourceObject: {fileID: 0}
2716+
m_PrefabInstance: {fileID: 0}
2717+
m_PrefabAsset: {fileID: 0}
2718+
serializedVersion: 6
2719+
m_Component:
2720+
- component: {fileID: 1741720219296545283}
2721+
- component: {fileID: 1982839992926161762}
2722+
- component: {fileID: 1624248715577640041}
2723+
- component: {fileID: 6839878271182632936}
2724+
m_Layer: 5
2725+
m_Name: Close Button
2726+
m_TagString: Untagged
2727+
m_Icon: {fileID: 0}
2728+
m_NavMeshLayer: 0
2729+
m_StaticEditorFlags: 0
2730+
m_IsActive: 1
2731+
--- !u!224 &1741720219296545283
2732+
RectTransform:
2733+
m_ObjectHideFlags: 0
2734+
m_CorrespondingSourceObject: {fileID: 0}
2735+
m_PrefabInstance: {fileID: 0}
2736+
m_PrefabAsset: {fileID: 0}
2737+
m_GameObject: {fileID: 4723286903512921305}
2738+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
2739+
m_LocalPosition: {x: 0, y: 0, z: 0}
2740+
m_LocalScale: {x: 1, y: 1, z: 1}
2741+
m_ConstrainProportionsScale: 0
2742+
m_Children:
2743+
- {fileID: 7386148524240149116}
2744+
m_Father: {fileID: 3630024249061363983}
2745+
m_RootOrder: 6
2746+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
2747+
m_AnchorMin: {x: 1, y: 1}
2748+
m_AnchorMax: {x: 1, y: 1}
2749+
m_AnchoredPosition: {x: -21.5, y: -20.839996}
2750+
m_SizeDelta: {x: 31.915894, y: 31.094803}
2751+
m_Pivot: {x: 0.5, y: 0.5}
2752+
--- !u!222 &1982839992926161762
2753+
CanvasRenderer:
2754+
m_ObjectHideFlags: 0
2755+
m_CorrespondingSourceObject: {fileID: 0}
2756+
m_PrefabInstance: {fileID: 0}
2757+
m_PrefabAsset: {fileID: 0}
2758+
m_GameObject: {fileID: 4723286903512921305}
2759+
m_CullTransparentMesh: 1
2760+
--- !u!114 &1624248715577640041
2761+
MonoBehaviour:
2762+
m_ObjectHideFlags: 0
2763+
m_CorrespondingSourceObject: {fileID: 0}
2764+
m_PrefabInstance: {fileID: 0}
2765+
m_PrefabAsset: {fileID: 0}
2766+
m_GameObject: {fileID: 4723286903512921305}
2767+
m_Enabled: 1
2768+
m_EditorHideFlags: 0
2769+
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
2770+
m_Name:
2771+
m_EditorClassIdentifier:
2772+
m_Material: {fileID: 0}
2773+
m_Color: {r: 1, g: 1, b: 1, a: 1}
2774+
m_RaycastTarget: 1
2775+
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
2776+
m_Maskable: 1
2777+
m_OnCullStateChanged:
2778+
m_PersistentCalls:
2779+
m_Calls: []
2780+
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
2781+
m_Type: 1
2782+
m_PreserveAspect: 0
2783+
m_FillCenter: 1
2784+
m_FillMethod: 4
2785+
m_FillAmount: 1
2786+
m_FillClockwise: 1
2787+
m_FillOrigin: 0
2788+
m_UseSpriteMesh: 0
2789+
m_PixelsPerUnitMultiplier: 1
2790+
--- !u!114 &6839878271182632936
2791+
MonoBehaviour:
2792+
m_ObjectHideFlags: 0
2793+
m_CorrespondingSourceObject: {fileID: 0}
2794+
m_PrefabInstance: {fileID: 0}
2795+
m_PrefabAsset: {fileID: 0}
2796+
m_GameObject: {fileID: 4723286903512921305}
2797+
m_Enabled: 1
2798+
m_EditorHideFlags: 0
2799+
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
2800+
m_Name:
2801+
m_EditorClassIdentifier:
2802+
m_Navigation:
2803+
m_Mode: 3
2804+
m_WrapAround: 0
2805+
m_SelectOnUp: {fileID: 0}
2806+
m_SelectOnDown: {fileID: 0}
2807+
m_SelectOnLeft: {fileID: 0}
2808+
m_SelectOnRight: {fileID: 0}
2809+
m_Transition: 1
2810+
m_Colors:
2811+
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
2812+
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
2813+
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
2814+
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
2815+
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
2816+
m_ColorMultiplier: 1
2817+
m_FadeDuration: 0.1
2818+
m_SpriteState:
2819+
m_HighlightedSprite: {fileID: 0}
2820+
m_PressedSprite: {fileID: 0}
2821+
m_SelectedSprite: {fileID: 0}
2822+
m_DisabledSprite: {fileID: 0}
2823+
m_AnimationTriggers:
2824+
m_NormalTrigger: Normal
2825+
m_HighlightedTrigger: Highlighted
2826+
m_PressedTrigger: Pressed
2827+
m_SelectedTrigger: Selected
2828+
m_DisabledTrigger: Disabled
2829+
m_Interactable: 1
2830+
m_TargetGraphic: {fileID: 1624248715577640041}
2831+
m_OnClick:
2832+
m_PersistentCalls:
2833+
m_Calls: []

0 commit comments

Comments
 (0)