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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user