@kayelaa/canvas API - v0.2.15
    Preparing search index...

    Variable useEntityConst

    useEntity: () => KaylaElementRef = ...

    Returns a stable ref to the underlying raw KaylaRectEntity (LEA entity).

    This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks. The call order of all hooks is strictly fixed across every refresh; reordering calls will corrupt internal state.

    Use when you need direct access to LEA-specific features not exposed on KaylaRect (custom flags, advanced transforms…).

    Most of the time prefer useRect — it wraps the same entity with a nicer, game-oriented API.

    Type Declaration

    const entityRef = useEntity();
    entityRef.current.setFlag("invincible", true);

    useTick(() => {
    if (entityRef.current.getFlag("invincible")) {
    // skip damage logic
    }
    });
    • useRef(self) — alternative way to get the same entity ref
    • useRect — usually the better daily driver