Function

addPrefab

(nameOrObject: SerializedGameObj | string, compList?: [...T]): GameObj<T[number]>

Assemble a game object from a prefab asset loaded with loadPrefab or using createPrefab.

loadPrefab("bean", "/prefabs/bean.kaprefab")

addPrefab("bean", [
    pos(40, 40)
])

returns The added game object that contains all properties and methods each component offers.

group Game Obj

kaplay logo

Components