|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[ExecuteInEditMode] |
|
|
|
public partial class UIWidgetsPanel : RawImage, IUIWidgetsWindow { |
|
|
|
static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>(); |
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
IEnumerator ReEnableUIWidgetsNextFrame() { |
|
|
|
yield return null; |
|
|
|
enabled = true; |
|
|
|
} |
|
|
|
|
|
|
|
IEnumerator DoInitAndroid() { |
|
|
|
yield return new WaitForEndOfFrame(); |
|
|
|
AndroidPlatformUtil.Init(); |
|
|
|
yield return new WaitForEndOfFrame(); |
|
|
|
enabled = true; |
|
|
|
} |
|
|
|
startCoroutine(DoInitAndroid()); |
|
|
|
AndroidPlatformUtil.Init(); |
|
|
|
startCoroutine(ReEnableUIWidgetsNextFrame()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
|
|
|
#if !UNITY_EDITOR && UNITY_ANDROID
|
|
|
|
if (!IsAndroidInitialized()) {return ;} |
|
|
|
#endif
|
|
|
|
// If user duplicates uiwidgets gameobject in scene, canvas could be null during OnEnable, which results in error. Skip to avoid error.
|
|
|
|
// More explanation: during duplication, editor wakes and enables behaviors in certain order. GameObject behaviors are enabled before canvas.
|
|
|
|
if(canvas == null){ |
|
|
|
enabled = false; |
|
|
|
startCoroutine(ReEnableUIWidgetsNextFrame()); |
|
|
|
return; |
|
|
|
} |
|
|
|
#if !UNITY_EDITOR && UNITY_IOS
|
|
|
|
//the hook API cannot be automatically called on IOS, so we need try hook it here
|
|
|
|
Hooks.tryHook(); |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
protected override void OnDisable() { |
|
|
|
unregisterPanel(this); |
|
|
|
D.assert(_wrapper != null); |
|
|
|
_wrapper?.Destroy(); |
|
|
|
if (_wrapper != null) { |
|
|
|
unregisterPanel(this); |
|
|
|
_wrapper.Destroy(); |
|
|
|
} |
|
|
|
|
|
|
|
_wrapper = null; |
|
|
|
texture = null; |
|
|
|
Input_OnDisable(); |
|
|
|