Prefab's icon

Prefab 1.0.2 Scripts 4.0 Community

Submitted by user KoBeWi; MIT; 2023-11-16

Simple wrapper for PackedScene that allows you to quickly pack part of a scene, so you can have e.g. "internal scenes" that you don't need to save to separate file. Usage:

var prefab = Prefab.create($AnyNode)

$AnyNode will be freed and you can then instance the prefab to make copies of that node. Prefab automatically sets the owner of the children, so they are packed too. You can change how node is freed by passing Prefab.FREE_MODE_DEFERRED or Prefab.FREE_MODE_NONE as the second argument of create().

You can also save the prefab to a file, but it's not the intended usage. See repo README for more info.


View files Download Submit an issue Recent Edits