浏览代码

update android gl init

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
dd9c27b5
共有 3 个文件被更改,包括 65 次插入48 次删除
  1. 60
      Samples/UIWidgetsSamples_2019_4/Assets/CountDemo.unity
  2. 21
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  3. 32
      Samples/UIWidgetsSamples_2019_4/Assets/AndroidWorkAround.cs

60
Samples/UIWidgetsSamples_2019_4/Assets/CountDemo.unity


m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!28 &766599190
Texture2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_TextureFormat: 0
m_MipCount: 1
m_IsReadable: 1
m_IgnoreMasterTextureLimit: 0
m_IsPreProcessed: 0
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_AlphaIsTransparency: 0
m_ImageCount: 0
m_TextureDimension: 2
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 0
m_WrapV: 0
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
image data: 0
_typelessdata:
m_StreamData:
offset: 0
size: 0
path:
--- !u!1 &1344837310
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 1777874941}
- component: {fileID: 1777874942}
- component: {fileID: 1777874943}
- component: {fileID: 1777874944}
m_Layer: 5
m_Name: RawImage
m_TagString: Untagged

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1777874940}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0817e3443c80cb943a03dcf7b120bd2e, type: 3}
m_Name:

m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 0}
m_Texture: {fileID: 766599190}
m_UVRect:
serializedVersion: 2
x: 0

hardwareAntiAliasing: 0
fonts: []
m_ShowDebugLog: 0
--- !u!114 &1777874944
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1777874940}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcb4984097885463dbe58d12837993ce, type: 3}
m_Name:
m_EditorClassIdentifier:
panel: {fileID: 0}

21
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


using System;
using System.Collections;
using System.Collections.Generic;
using engine2;
using Unity.UIWidgets.editor2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;

static bool _ShowDebugLog = false;
#if !UNITY_EDITOR && UNITY_ANDROID
static bool InitAnroidGLFlag = true;
IEnumerator InitAnroidGL() {
yield return new WaitForEndOfFrame();
AndroidGLInit.Init();
yield return new WaitForEndOfFrame();
enabled = true;
}
#endif
#if !UNITY_EDITOR && UNITY_ANDROID
if (InitAnroidGLFlag) {
InitAnroidGLFlag = false;
startCoroutine(InitAnroidGL());
enabled = false;
return;
}
#endif
base.OnEnable();
var settings = new Dictionary<string, object>();
if (fonts != null && fonts.Length > 0) {

32
Samples/UIWidgetsSamples_2019_4/Assets/AndroidWorkAround.cs


using engine2;
using UIWidgetsSample;
using Unity.UIWidgets.engine2;
using UnityEngine;
namespace Unity.UIWidgets.ui
{
public class AndroidWorkAround : MonoBehaviour
{
UIWidgetsPanel panel;
// Start is called before the first frame update
void Start()
{
panel = GetComponent<UIWidgetsPanel>();
panel.enabled = false;
AndroidGLInit.Init();
}
// Update is called once per frame
void Update()
{
if (!panel.enabled)
{
panel.enabled = true;
enabled = false;
}
}
}
}
正在加载...
取消
保存