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

Add documentation to note that some diagnostic plugins must be added after DiagnosticsPlugin #8785

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ use bevy_diagnostic::{
use bevy_ecs::prelude::*;

/// Adds an asset count diagnostic to an [`App`] for assets of type `T`.
///
/// # Warning
///
/// Must be added after [`DiagnosticsPlugin`](bevy_diagnostic::DiagnosticsPlugin) or a panic will occur due to missing resources.
pub struct AssetCountDiagnosticsPlugin<T: Asset> {
marker: std::marker::PhantomData<T>,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ use bevy_ecs::entity::Entities;

use crate::{Diagnostic, DiagnosticId, Diagnostics, RegisterDiagnostic};

/// Adds "entity count" diagnostic to an App
/// Adds "entity count" diagnostic to an [`App`]
///
/// # Warning
///
/// Must be added after [`DiagnosticsPlugin`](crate::DiagnosticsPlugin) or a panic will occur due to missing resources.
#[derive(Default)]
pub struct EntityCountDiagnosticsPlugin;

Expand Down
6 changes: 5 additions & 1 deletion crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use bevy_core::FrameCount;
use bevy_ecs::prelude::*;
use bevy_time::Time;

/// Adds "frame time" diagnostic to an App, specifically "frame time", "fps" and "frame count"
/// Adds "frame time" diagnostic to an [`App`], specifically "frame time", "fps" and "frame count"
///
/// # Warning
///
/// Must be added after [`DiagnosticsPlugin`](crate::DiagnosticsPlugin) or a panic will occur due to missing resources.
#[derive(Default)]
pub struct FrameTimeDiagnosticsPlugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ use bevy_app::prelude::*;
/// * macos
///
/// NOT supported when using the `bevy/dynamic` feature even when using previously mentioned targets
///
/// # Warning
///
/// Must be added after [`DiagnosticsPlugin`](crate::DiagnosticsPlugin) or a panic will occur due to missing resources.
#[derive(Default)]
pub struct SystemInformationDiagnosticsPlugin;
impl Plugin for SystemInformationDiagnosticsPlugin {
Expand Down