Нашёл причину утечки памяти
This commit is contained in:
1 parent
60c28f54f2
commit
320847af5b
229 files changed
+3094
-18282
No files matched your search
@@ -88,8 +88,8 @@ namespace Code.Example.Platformer.Entity
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Debug.LogWarning($"Enemies released");
|
||||
_playerPrefabHandle.Release();
|
||||
UnityEngine.Debug.LogWarning($"Player released");
|
||||
if(_playerPrefabHandle.IsValid()) _playerPrefabHandle.Release();
|
||||
|
||||
_playerConfigHandle.Release();
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab2cbe7f4c0142f980f9640c57d27030
|
||||
timeCreated: 1774277361
|
||||
@@ -76,11 +76,22 @@ namespace Code.Example.Platformer
|
||||
Context.CameraFactory.ReleaseCinemachineCamera(CameraMode.Platformer);
|
||||
Context.InputService.DisableMap(ActionMappings.Platformer);
|
||||
|
||||
_audioFactory.ReleaseAudios(AudioNames.Platformer);
|
||||
Context.AudioService.ChangeGroupVolume(
|
||||
AudioGroupType.Music,
|
||||
0f,
|
||||
0.5f,
|
||||
ReleasePlatformerMusic);
|
||||
|
||||
EventBus.Unsubscribe(this);
|
||||
}
|
||||
|
||||
private void ReleasePlatformerMusic()
|
||||
{
|
||||
Context.AudioService.CancelMusic(AudioNames.Platformer, 0);
|
||||
Context.AudioService.CancelMusic(AudioNames.Platformer, 7);
|
||||
_audioFactory.ReleaseAudios(AudioNames.Platformer);
|
||||
}
|
||||
|
||||
private void StartInitialLoading()
|
||||
{
|
||||
|
||||
@@ -259,6 +270,25 @@ namespace Code.Example.Platformer
|
||||
}
|
||||
|
||||
public void PlayerDied()
|
||||
{
|
||||
_loading = new(2, EndGameLoading);
|
||||
|
||||
Context.AudioService.ChangeGroupVolume(
|
||||
AudioGroupType.Music,
|
||||
0f,
|
||||
0.5f,
|
||||
OffTheMusic);
|
||||
|
||||
Context.UIService.OpenPanel(UIPanelType.Loading);
|
||||
}
|
||||
|
||||
private void OffTheMusic()
|
||||
{
|
||||
ReleasePlatformerMusic();
|
||||
_loading.DoProgress();
|
||||
}
|
||||
|
||||
private void EndGameLoading()
|
||||
{
|
||||
Context.StateMachine.SwitchState(AppStates.MainMenu)
|
||||
.AllowStateTransition(AppStates.Platformer);
|
||||
|
||||
Reference in new issue
Block a user