Reads a typed component copy from an entity; the entity must have that component.
Signature
func get[C](entity: Entity) -> CC means a concrete type selector. The result is a component copy; update the live entity with set, or use a system binding or bind[C](entity) method callback for persistent mutation.
Parameters
entity: Entity- An entity that has the selected concrete type component.
Returns
CA copy of component C.
Examples
Select a component
The explicit selector fixes the component type for a function value.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
2
Rust definition
Rust interpreter builtin dispatch; C must name a concrete type and is checked during specialization.
View Rust documentation →Support: runtime