Slash-The-Hordes/assets/Scripts/AppRoot/AppRootUtils.ts

14 lines
477 B
TypeScript
Raw Permalink Normal View History

2023-01-02 09:56:41 +00:00
import { delay } from "../Services/Utils/AsyncUtils";
import { AppRoot } from "./AppRoot";
export async function requireAppRootAsync(): Promise<void> {
console.log("Waiting for app root");
while (AppRoot.Instance == null) await delay(10);
AppRoot.Instance.node.setSiblingIndex(1000); // render on top
AppRoot.Instance.node.active = false; // forces engine to reorder by hierarchy
AppRoot.Instance.node.active = true;
console.log("App root ready");
}