private void SyncNext() { if (_scenesToSync.Count == 0) { _syncingAttribute = null; Resources.UnloadUnusedAssets(); DispatchSceneLoadedSignal(); return; } _syncingAttribute = _scenesToSync.Dequeue(); if ((_syncingAttribute.Relationship & SceneRelationshipType.Exclude) != 0) { UnloadSceneSignal.Dispatch(_syncingAttribute.SceneType); SyncNext(); } else if ((_syncingAttribute.Relationship & SceneRelationshipType.Include) != 0) { LoadSceneSignal.Dispatch(_syncingAttribute.SceneType); } else { SyncNext(); } }
protected override void OnDestroy() { var atts = GetType().GetAttributes <SceneRelationshipAttribute>(false); foreach (var att in atts) { if ((att.Relationship & SceneRelationshipType.Depend) != 0) { UnloadSceneSignal.Dispatch(att.SceneType); } } UnmapBindings(); Resources.UnloadUnusedAssets(); SceneUnloadedSignal.Dispatch(GetType()); base.OnDestroy(); }