chicken_dy/Assets/WX-WASM-SDK/HideLoadingPage.cs

31 lines
685 B
C#
Raw Normal View History

2022-07-27 13:57:29 +00:00
using System;
using UnityEngine;
using WeChatWASM;
class CheckFrame : MonoBehaviour
{
int frameCnt = 0;
private void Update()
{
frameCnt++;
if (frameCnt == 2)
{
#if UNITY_WEBGL && !UNITY_EDITOR
WX.HideLoadingPage();
#endif
Destroy(this);
}
}
}
class HideLoadingPage : MonoBehaviour
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void OnGameLaunch()
{
var gameObject = new GameObject("HideLoadingPage");
gameObject.AddComponent<CheckFrame>();
DontDestroyOnLoad(gameObject);
}
}