@@ -65,18 +65,22 @@ public override GUIContent titleContent {
65
65
protected override float queryDevicePixelRatio ( ) {
66
66
return this . _uiWidgetsPanel . devicePixelRatio ;
67
67
}
68
-
68
+
69
69
protected override int queryAntiAliasing ( ) {
70
70
return this . _uiWidgetsPanel . antiAliasing ;
71
71
}
72
72
73
73
protected override Vector2 queryWindowSize ( ) {
74
74
var rect = this . _uiWidgetsPanel . rectTransform . rect ;
75
- var size = new Vector2 ( rect . width , rect . height ) *
76
- this . _uiWidgetsPanel . canvas . scaleFactor / this . _uiWidgetsPanel . devicePixelRatio ;
77
- size . x = Mathf . Round ( size . x ) ;
78
- size . y = Mathf . Round ( size . y ) ;
79
- return size ;
75
+ if ( ! ReferenceEquals ( this . _uiWidgetsPanel . canvas , null ) ) {
76
+ var size = new Vector2 ( rect . width , rect . height ) *
77
+ this . _uiWidgetsPanel . canvas . scaleFactor / this . _uiWidgetsPanel . devicePixelRatio ;
78
+ size . x = Mathf . Round ( size . x ) ;
79
+ size . y = Mathf . Round ( size . y ) ;
80
+ return size ;
81
+ }
82
+
83
+ return new Vector2 ( 0 , 0 ) ;
80
84
}
81
85
82
86
public Offset windowPosToScreenPos ( Offset windowPos ) {
@@ -134,7 +138,7 @@ protected override void OnEnable() {
134
138
135
139
this . _displayMetrics = DisplayMetricsProvider . provider ( ) ;
136
140
this . _displayMetrics . OnEnable ( ) ;
137
-
141
+
138
142
this . _enteredPointers . Clear ( ) ;
139
143
140
144
if ( _repaintEvent == null ) {
@@ -162,11 +166,9 @@ public float devicePixelRatio {
162
166
: this . _displayMetrics . devicePixelRatio ;
163
167
}
164
168
}
165
-
169
+
166
170
public int antiAliasing {
167
- get {
168
- return this . antiAliasingOverride >= 0 ? this . antiAliasingOverride : QualitySettings . antiAliasing ;
169
- }
171
+ get { return this . antiAliasingOverride >= 0 ? this . antiAliasingOverride : QualitySettings . antiAliasing ; }
170
172
}
171
173
172
174
public WindowPadding viewPadding {
@@ -177,17 +179,17 @@ public WindowPadding viewInsets {
177
179
get { return this . _displayMetrics . viewInsets ; }
178
180
}
179
181
180
- protected override void OnDisable ( ) {
181
- D . assert ( this . _windowAdapter != null ) ;
182
- this . _windowAdapter . OnDisable ( ) ;
183
- this . _windowAdapter = null ;
184
- base . OnDisable ( ) ;
182
+ protected override void OnDisable ( ) {
183
+ D . assert ( this . _windowAdapter != null ) ;
184
+ this . _windowAdapter . OnDisable ( ) ;
185
+ this . _windowAdapter = null ;
186
+ base . OnDisable ( ) ;
185
187
}
186
-
188
+
187
189
protected virtual Widget createWidget ( ) {
188
190
return null ;
189
191
}
190
-
192
+
191
193
public void recreateWidget ( ) {
192
194
Widget root ;
193
195
using ( this . _windowAdapter . getScope ( ) ) {
@@ -205,12 +207,10 @@ internal void applyRenderTexture(Rect screenRect, Texture texture, Material mat)
205
207
protected virtual void Update ( ) {
206
208
this . _displayMetrics . Update ( ) ;
207
209
UIWidgetsMessageManager . ensureUIWidgetsMessageManagerIfNeeded ( ) ;
208
-
210
+
209
211
#if UNITY_ANDROID
210
212
if ( Input . GetKeyDown ( KeyCode . Escape ) ) {
211
- this . _windowAdapter . withBinding ( ( ) => {
212
- WidgetsBinding . instance . handlePopRoute ( ) ;
213
- } ) ;
213
+ this . _windowAdapter . withBinding ( ( ) => { WidgetsBinding . instance . handlePopRoute ( ) ; } ) ;
214
214
}
215
215
#endif
216
216
@@ -277,6 +277,7 @@ int getMouseButtonDown() {
277
277
break ;
278
278
}
279
279
}
280
+
280
281
return InputUtils . getMouseButtonKey ( defaultKey ) ;
281
282
}
282
283
0 commit comments