Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Prefabs

[17:14] static extends: object

Wraps FXGL's Prefabs static helper. Prefabs exposes ready-made entity templates so users can drop common 3D scene objects into a game without rebuilding their components from scratch. The upstream Prefabs class is marked experimental in FXGL; the only stable factory at present is newDoor, which returns an Entity wired with an ActivatorComponent + DoorComponent.

Methods

  • newDoor ()

    Returns a new door Entity wired with both an ActivatorComponent (for open / close toggling) and a DoorComponent (the 3D model + open animation). Add the returned Entity to the GameWorld and toggle its activator to swing the door.

    • @r An Entity wrapper.