public void UnLoad() { if (_handle != null) { MotionLog.Log($"Begin to unload scene : {Location}"); _finishCallback = null; _progressCallback = null; _lastProgressValue = 0; // 异步卸载场景 _handle.UnloadAsync(); _handle = null; } }
public void Load(bool isAdditive, bool activeOnLoad, System.Action <SceneOperationHandle> finishCallback, System.Action <int> progressCallbcak) { if (_handle != null) { return; } var _sceneMode = isAdditive ? LoadSceneMode.Additive : LoadSceneMode.Single; MotionLog.Log($"Begin to load scene : {Location}"); _finishCallback = finishCallback; _progressCallback = progressCallbcak; _handle = ResourceManager.Instance.LoadSceneAsync(Location, _sceneMode, activeOnLoad); _handle.Completed += Handle_Completed; }
// 资源回调 private void Handle_Completed(SceneOperationHandle handle) { _finishCallback?.Invoke(_handle); }