Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes when creating a new entity, the components on a previously disposed entity with the same ID are still present #189

Open
mystborn opened this issue Jan 14, 2024 · 2 comments

Comments

@mystborn
Copy link

I currently have a very basic SHMUP game running, and as stated in the title, sometimes when spawning new entities, the components from the old ones are still around which causes some very funky behaviour and was a debugging nightmare. I've tried a few different solutions, using an EntityCommandRecorder, just saving a list of delete and create actions that get run after the systems during a frame, etc, but nothing works. Tried on the latest stable and unstable branches.

@nrader95
Copy link
Contributor

Any idea of how this can be reliably reproduced?
Although i doubt it will be fixed in this main repo as it didnt seen new activity for about a year, so all hope is on forks, i guess.

@alkboda
Copy link

alkboda commented Sep 25, 2024

I have some idea, but can't say that that's exactly your case. Entity has ID and Version. When you cache somehow entity, for example on MonoBehaviours field and dispose this entity somewhere else. Then you create new entities and some of them will get exact same ID as disposed one but with Version incremented. In such situation if you call for example Set on disposed entity within MonoBehaviour this will Set component to newly created entity with greater Version. Is up to you to monitor such cases, you wont get any warnings or exceptions related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants