mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
ecs: fix local resource indexing
This commit is contained in:
parent
8d3a5ae0f1
commit
98ed29aacc
1 changed files with 2 additions and 1 deletions
|
@ -57,10 +57,11 @@ impl Resources {
|
||||||
if let Some(index) = self.system_id_to_archetype_index.get(&id.0).cloned() {
|
if let Some(index) = self.system_id_to_archetype_index.get(&id.0).cloned() {
|
||||||
self.insert_index(resource, index);
|
self.insert_index(resource, index);
|
||||||
} else {
|
} else {
|
||||||
let index = self.archetype_len::<T>();
|
let mut index = self.archetype_len::<T>();
|
||||||
// index 0 is reserved for the global non-system resource
|
// index 0 is reserved for the global non-system resource
|
||||||
if index == 0 {
|
if index == 0 {
|
||||||
self.allocate_next::<T>();
|
self.allocate_next::<T>();
|
||||||
|
index += 1;
|
||||||
}
|
}
|
||||||
self.insert_index(resource, index);
|
self.insert_index(resource, index);
|
||||||
self.system_id_to_archetype_index.insert(id.0, index);
|
self.system_id_to_archetype_index.insert(id.0, index);
|
||||||
|
|
Loading…
Reference in a new issue