public static void Render(ReactElement component, ComponentReady ready) { if (component == null) { throw new ArgumentNullException(nameof(component)); } if (ready == null) { throw new ArgumentNullException(nameof(ready)); } var container = Document.CreateElement("div"); container.Style.Display = Display.None; Window.SetTimeout(() => // Use SetTimeout to ensure that the DOM has updated (that the container has been added) { try { React.Render( new HostComponent( afterUpdate: () => ready(container), wrappedComponent: component ), container ); } catch { container.Remove(); throw; } }); }
private void Awake() { componentReadyEvent = new ComponentReady(); EventManager.AddComponentReadyInvoker(this); EventManager.AddGameReadyListener(OnGameReady); Initialize(); GetComponent <T>().enabled = false; componentReadyEvent.Invoke(ComponentType); }