using System.Collections; using UnityEngine; using LoadingScreenBuildPro; public sealed class GuideCustomWork : MonoBehaviour { [SerializeField] private LoadingLayout layout; public void Begin() => StartCoroutine(Work()); private IEnumerator Work() { if (!layout || LoadingScreenBuilder.IsLoading) yield break; var policy = ScriptableObject.CreateInstance(); policy.completion = CompletionMode.AsyncOnly; policy.scenePolicy = ScenePolicy.None; policy.progressSource = ProgressSource.Manual; var operation = new ManualLoadingOperation(); var handle = LoadingScreenBuilder.Show(new LoadingRequest { layout = layout, behaviour = policy, operation = operation }); float elapsed = 0f; while (!handle.IsDone && elapsed < 2f) { elapsed += Time.unscaledDeltaTime; operation.Report(elapsed / 2f); LoadingScreenBuilder.ReportProgress(elapsed / 2f, handle); yield return null; } if (!handle.IsDone) operation.Complete(); while (!handle.IsDone) yield return null; Destroy(policy); } }