static IObservable <Unit> LoadUIRoot() { if (_uiData.uiRoot != null) { return(Observable.ReturnUnit()); } return(AssetProcess.Load <GameObject>(UIConstant.UI_ROOT_ASSET_NAME).Do(root => { _uiData.uiRoot = root.Spawn(); GameObject.DontDestroyOnLoad(_uiData.uiRoot); }).AsUnitObservable()); }
static IObservable <Unit> LoadUI(string assetPath) { if (_uiData.unitDict.ContainsKey(assetPath)) { return(Observable.ReturnUnit()); } return(AssetProcess.Load <GameObject>(assetPath) .Do(asset => { WorldManager.Instance.Factory.CreateUI(assetPath, asset, _uiData); }) .AsUnitObservable()); }