Patch - Adds component shutdown functionality - V13.6.1

Implements a shutdown mechanism for components and entities,
ensuring proper resource release and preventing memory leaks.

This change introduces a virtual `Shutdown` method to the
`Component` class, allowing derived components to release
specific resources when they are removed from an entity or
when the entity is destroyed. The `Entity` class now calls
the `Shutdown` method on all its components during its own
release process. The `EntityManager` now calls the
`release()` method when destroying an entity.

This enhancement ensures that resources, such as FMOD sound
objects and channels in the `AudioComponent`, are properly
released, preventing potential resource leaks and improving
the stability of the engine.
This commit is contained in:
2025-09-17 16:47:01 +02:00
parent 7fc4b08808
commit 76fdd3c76e
5 changed files with 62 additions and 19 deletions

View File

@@ -32,6 +32,11 @@ public:
*/
virtual void Initialize() {}
/**
*Virtual function to shutdown the component.
*/
virtual void Shutdown() {}
/**
* Virtual function to update the component.
* @param deltaTime Time since the last update.