Add usage notes for register_component (#18011)

# Objective

- Add usage notes for `register_component`, fixes #16447


## Testing

CI
This commit is contained in:
VitalyR 2025-02-25 05:47:25 +08:00 committed by GitHub
parent 172c020b60
commit 6bae04ab36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -247,6 +247,10 @@ impl World {
}
/// Registers a new [`Component`] type and returns the [`ComponentId`] created for it.
///
/// # Usage Notes
/// In most cases, you don't need to call this method directly since component registration
/// happens automatically during system initialization.
pub fn register_component<T: Component>(&mut self) -> ComponentId {
self.components.register_component::<T>()
}