Skip to content

Assets V2, Res<Assets<SplineAsset>.is_changed() always true (looks like asset v2 reload my asset every frame, but is not changed) #11175

Closed
@fe3dback

Description

@fe3dback

Bevy version

bevy = { version = "0.12.1", features = ["dynamic_linking", "file_watcher", "embedded_watcher"] }

Relevant system information

os: linux
rust: rustc
commit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be
commit-date: 2023-08-23
host: x86_64-unknown-linux-gnu
release: 1.72.0
LLVM version: 16.0.5

What you did

Upgrade bevy from 0.11 to 0.12

What went wrong

since 0.12, my game lagging alot (fps drops from 60 to 1).
after short investigation, i found a problem:

pub fn editor_regenerate_chunks_when_params_changed(
    mut world: ResMut<WorldResource>,
    mut writer: EventWriter<ChunkGeneratedEvent>,
    rnd: Res<RandResource>,
    props: Res<GenerationResource>,
    spline_handles: Res<SplinesResource>,
    spline_assets: Res<Assets<SplineAsset>>,
) {
    if !(props.is_changed() || rnd.is_changed() || spline_assets.is_changed()) {
        return;
    }

    // slow code, that should execute very rarely
}

In my code i have some resources, that should trigger map re-generation, but only if this resources is changed.
One of this resource is spline_assets: Res<Assets<SplineAsset>>.

Code in spline_assets.is_changed() executed as always true.
I think it's something related to new asset system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions