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

Multiple issues when using AssetCountDiagnosticPlugin #2156

Closed
wendivoid opened this issue May 13, 2021 · 1 comment
Closed

Multiple issues when using AssetCountDiagnosticPlugin #2156

wendivoid opened this issue May 13, 2021 · 1 comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior

Comments

@wendivoid
Copy link
Contributor

Bevy version

0.5.0

Operating system & version

Manjaro 21.04

What you did

Attempt to use the AssetCountDiagnosticsPlugin with a Texture or Mesh.

What you expected to happen

I expected this to work without error

use bevy::prelude::*;
use bevy::asset::diagnostic::AssetCountDiagnosticsPlugin;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_plugin(AssetCountDiagnosticsPlugin::<Texture>::default())
        .run()
}

What actually happened

I receive this error in the console

May 13 11:31:16.496  WARN bevy_diagnostic::diagnostic: Diagnostic "asset_count bevy_render::texture::texture::Texture" has name longer than 32 characters, and so might overflow in the LogDiagnosticsPlugin Consider using a shorter name.

I may be wrong but since the 'name' it is complaining about is the full path of the object, can this 'name' be changed from outside bevy?

Additional Error

Another thing I've noticed is I'm unable to to create a AssetCountDiagnosticsPlugin for Mesh assets.

Since Mesh doesn't implement Default it fails to compile

   Compiling asset-count v0.1.0 (/home/patrick/Projects/asset-count)
error[E0599]: the function or associated item `default` exists for struct `AssetCountDiagnosticsPlugin<bevy::prelude::Mesh>`, but its trait bounds were not satisfied
   --> src/main.rs:7:58
    |
7   |         .add_plugin(AssetCountDiagnosticsPlugin::<Mesh>::default())
    |                                                          ^^^^^^^ function or associated item cannot be called on `AssetCountDiagnosticsPlugin<bevy::prelude::Mesh>` due to unsatisfied trait bounds
    |
   ::: /home/patrick/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_asset-0.5.0/src/diagnostic/asset_count_diagnostics_plugin.rs:8:1
    |
8   | pub struct AssetCountDiagnosticsPlugin<T: Asset> {
    | ------------------------------------------------ doesn't satisfy `_: Default`
    |
   ::: /home/patrick/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.5.0/src/mesh/mesh.rs:209:1
    |
209 | pub struct Mesh {
    | --------------- doesn't satisfy `bevy::prelude::Mesh: Default`
    |
    = note: the following trait bounds were not satisfied:
            `bevy::prelude::Mesh: Default`
            which is required by `AssetCountDiagnosticsPlugin<bevy::prelude::Mesh>: Default`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: could not compile `asset-count`

To learn more, run the command again with --verbose.

By looking at the source of AssetCountDiagnosticsPlugin it appears that the default method is only implemented where T: Default. But it should be implemented for any T I believe

@wendivoid wendivoid added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels May 13, 2021
@mockersf
Copy link
Member

first issue should be fixed by #2165, second by #2077

@bors bors bot closed this as completed in 739224f May 14, 2021
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds and removed S-Needs-Triage This issue needs to be labelled labels Jul 8, 2021
ostwilkens pushed a commit to ostwilkens/bevy that referenced this issue Jul 27, 2021
fixes bevyengine#2156 
limit the diagnostic name to `MAX_DIAGNOSTIC_NAME_WIDTH` length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants