public void Start() { ObservableAssetBundle.LoadAssetBundle <GameObject> (AssetBundlePath, GuiName) .Timeout(TimeSpan.FromSeconds(5)) .Subscribe(obj => { if (obj == null) { Debug.LogError(" AssetBundle is null. Check Asset Path and Name. \n" + "assetBundlePath : " + AssetBundlePath + " / " + "assetName : " + GuiName ); FailAssetBundle(assetBundlePath, GuiName); return; } var go = Instantiate(obj, gameObject.transform); go.name = GuiName; initCanvasObject(go); //if ( isNowFree ) { AssetBundleManager.UnloadAssetBundle(StaticMethod.GetAssetBundleName(GuiName)); //} }, err => { FailAssetBundle(assetBundlePath, GuiName); }); /* * this.UpdateAsObservable () * .Where ( _ => canvasObject ) * .Where ( _ => callbackQueue.Count > 0 ) * .Select( x => callbackQueue.Dequeue() ) * .Subscribe ( callback => { * callback ( this ); * } ); */ /* * var temp = canvasObject.ObserveEveryValueChanged ( x => x ); * * temp * .TakeUntil(temp) * .Subscribe ( _ => { * * while ( callbackQueue.Count > 0 ) { * var callback = callbackQueue.Dequeue (); * callback( this ); * Debug.Log ( "aaaa" ); * } * * } ); * */ //스트림을 강제로 종료하는 방법은 없는지 고민 //강제로 컴플리트 시키는 방법 //->first this.UpdateAsObservable() .Where(_ => canvasObject) //.DistinctUntilChanged () .First() .Subscribe(_ => { while (callbackQueue.Count > 0) { var callback = callbackQueue.Dequeue(); callback(this); } }, () => Debug.Log("complete")); }