Comments (10)
Thanks for the report! I think we likely will want a map.despawn(commands, map_entity);
api for this. I can't have tiles be children of chunks for various reasons.
from bevy_ecs_tilemap.
They don't necessarily need to be children of chunks, do they?
Both chunks and tiles could all just be children of the Map entity itself.
from bevy_ecs_tilemap.
Part of the issue with having tiles be a child of the map entity or the chunk entity is that tiles don't have standard transforms, and bevy currently complains about that. We could give them standard transforms, but then its just a lot of extra data that is not needed and people might assume that changing a tile transform would change where a tile is located which isn't supported and isn't easy to support.
from bevy_ecs_tilemap.
tiles don't have standard transforms, and bevy currently complains about that
If that's the case, maybe we should suggest fixing it in Bevy. I don't see any reason why entities should be forced to have a Transform in order to be part of a hierarchy. Parent-child relationships are useful for a lot of things not related to positioning, such as in this case, for organizational purposes to make it easier to despawn all sub-entities when despawning the container entity.
from bevy_ecs_tilemap.
tiles don't have standard transforms, and bevy currently complains about that
If that's the case, maybe we should suggest fixing it in Bevy. I don't see any reason why entities should be forced to have a Transform in order to be part of a hierarchy.
Bevy relations RFC would fix this issue. :)
See:
bevyengine/rfcs#18
from bevy_ecs_tilemap.
tiles don't have standard transforms, and bevy currently complains about that
If that's the case, maybe we should suggest fixing it in Bevy. I don't see any reason why entities should be forced to have a Transform in order to be part of a hierarchy.
Bevy relations RFC would fix this issue. :)
See:
bevyengine/rfcs#18
Yeah, this would probably allow it, assuming you can have the ECS enforce the deletion of certain relation types when their container entity is despawned.
This seems like a much more complex change though, and way overkill if the goal is simply to ensure sub-entities are despawned.
from bevy_ecs_tilemap.
@forbjok I ran some tests with this, and I discovered a performance drop almost in half due to having a parent per child. If I instead have a map_query.despawn_layer(layer_id)
would that be acceptable?
from bevy_ecs_tilemap.
Interesting. I wonder why that would affect performance when tiles don't have transforms that would need to be propagated. Have you looked into why it's affecting performance?
from bevy_ecs_tilemap.
The performance is mainly lost due to how bevy_transform
propagates the transform information for parents/children. It always iterates over the children regardless of whether they have transforms or not.
from bevy_ecs_tilemap.
You can now use map_query.depsawn_map
to despawn an entire map including tiles. Optionally you can despawn layers with depsawn_layer
or tiles with: despawn_layer_tiles
.
from bevy_ecs_tilemap.
Related Issues (20)
- AnimatedTile add/remove bug HOT 2
- 0.12 bug: despawn + spawn during state change, without spawning texture, panics
- Wrong tiles placement when images height are superior to tiles height with isometric maps HOT 3
- TileStorage, TilemapSize, TileTextureIndex, TilePos are not Components anymore. HOT 2
- Obscure error in 'basic' example with slight modifications. HOT 3
- Update to Bevy 0.14 HOT 7
- could some one turn this in to an example ?
- Compile error: crate-private type `RenderChunkSize` in public interface HOT 6
- Instead ov `src/map/mod.rs`, it should just be `src/map.rs`. HOT 2
- Bevy 0.13 race condition resulting in tiles not rendering HOT 2
- Auditing examples on main after updating to Bevy 0.13 HOT 2
- Improve Tiled support HOT 3
- how to make a tilemap with atlas? HOT 3
- Does not render anything on my machine HOT 3
- Manage z-index with spritesheet moving character HOT 1
- layers and moving sprites HOT 4
- I have a problem with bevy 0.13
- TilemapPlugin trait bound not satistfied for bevy 0.14.0 HOT 2
- Consider adding another maintainer and cargo owner HOT 4
- webgl2 padding enhancement
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bevy_ecs_tilemap.