amethyst / amethyst/legion

Crash when deleting entities from a deserialized world (entity not found)

未關閉
#160 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
1.7k
分支
140
PR 合併指標
30 天內沒有已合併 PR

描述

I've been using Legion in my Nox Futura Rust port. It's generally excellent, but I've run into a bug. I didn't think you'd want to help me go through 13k lines of code, so I made a repo with a reproduction of the issue: https://github.com/thebracket/legion-serialize-bug-demo

It uses the serialization code from the example, wrapped in some functions. This is working _great_ with 30k entities in NF, loading nice and fast and all the queries/systems work with the loaded data. I know that Entity references in serialized data aren't done yet, so I've been using an identity tag (with a unique id) on entities I need to reference - with a view to replacing it with entity references at a later date. That's also been working well.

The bug: when you try to delete a deserialized entity, you get a crash. Legion appears to be unable to find the entity (even though it hands it to you and it looks ok, and referencing its components works fine) and crashes on an `unwrap` call. I've included full backtraces and example usage in the linked repo.

The example:

In `works_fine`:

1. Inserts 3 trees into the world. They have `TreeTag`, `IdentityTag(usize)` tags (the identity is incremented per tree) and a `Position` component.
2. It runs a query to filter to tree id # 1 and prints it.
3. Runs a query with entities to find tree # 1 and deletes it via a command buffer.
4. Searches for tree # 1 again to show that its actually gone.

That works great.

In `crashes()`:

1. Inserts 3 trees into the world. They have `TreeTag`, `IdentityTag(usize)` tags (the identity is incremented per tree) and a `Position` component.
2. It runs a query to filter to tree id # 1 and prints it.
3. Saves the world to a RON file, and re-loads it.
4. Finds tree # 1 and prints it again to prove that its there.
5. Runs a query with entities to find tree # 1 and deletes it via a command buffer.
6. It crashed!

Hopefully, I've just done something wrong in my copy/paste serialization code?

Thanks for taking the time to look at it. Legion is awesome.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。