Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

useResource

useResource(entity, key): { current: number; maximum: number; reserved?: number; } | undefined

An entity’s amount of the resource key, read from the world: { current, maximum, reserved }, or undefined while it has none. What <ResourceBar> draws, and the way to draw it any other way, such as an orb, a ring or a number.

Parameter Type
entity Entity | null
key ResourceKey

{ current: number; maximum: number; reserved?: number; }

Name Type Description
current number -
maximum number -
reserved? number What a running cast holds back. Health has none, since no cast holds health back; every other resource has it.

undefined