jeffcampbellmakesgames / Entitas-Redux

An entity-component framework for Unity with code generation and visual debugging
MIT License
104 stars 13 forks source link

Event system component will not generate cleanup systems #34

Closed jeffcampbellmakesgames closed 3 years ago

jeffcampbellmakesgames commented 3 years ago

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

This PR fixes (https://github.com/jeffcampbellmakesgames/Entitas-Redux/issues/31) by ensuring that any code-generated components for event systems do not generate any cleanup systems. The root of the issue arose from a copy-constructor for the event systems component data that inadvertently would copy over the data-provided cleanup attribute data. This PR resolves that by ensuring any copied over data for cleanup attributes is removed after the copy-constructor.

Fixes # (issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

I've created fixtures for this in (3e7779bc81e82f9a23e2ecece7b6a98593674506) and additional unit tests in (2571df0730ccb8c60db90650e8df8f05c00f7761) to verify that this behavior works as expected. Please run all unit tests to both verify this is working and does not disturb other framework behavior.

There is also an example commit (c3186f562b3085ce17b9b50354c5eb0138da4321) that will be deleted prior to merge that demonstrates how a component in this situation would not generate additional cleanup systems for its event listener component.

The relevant code effecting this change can be found in (64b459327bfefe622eaddbdbb9889c2b0d6e6cd4); this may be more useful than examining the entire PR as code-generation causes many file changes.

Checklist: