API
Static methods
staticbind(path:String, object:Dynamic):Void
Load the Prefab from path and assign all created hierarchy objects to
fields of the object instance.
Parameters:
path |
Prefab name. Can point to a subfolder and must be without an extension. |
|---|---|
object |
An instance to which the prefab adds itself and assigns fields from the
loaded |
staticload(path:String, ?parent:Object, ?field:Array<Field>):Prefab
Load the Prefab with the given name path from the res
folder.
path can point to a subfolder (eg: "ui/button") and must be without an
extension.
Parameters:
path |
Prefab name. |
|---|---|
parent |
An optional parent
|
field |
An optional |
staticmake(path:String, object:Prefab, ?field:Array<Field>):Void
Initializes an existing Prefab instance by loading a hierarchy from the given path and attaching all loaded objects as children of this prefab. The loaded hierarchy is stored in the hierarchy field, and any objects whose names match fields of this Prefab instance are automatically assigned to those fields.
Parameters:
path |
Prefab name. Can point to a subfolder and must be without an extension. |
|---|---|
object |
An existing |
field |
An optional |
class Prefab
package hxe
extends Object
Constructor
new(?path:String, ?parent:Object, ?field:Array<Field>)
Creates a Prefab instance and loads its visual content from the prefab file at the specified path. The created objects are instantiated and attached to this prefab’s hierarchy using hxe.Lib.make.
Parameters:
path |
Prefab name. Can point to a subfolder and must be without an extension. |
|---|---|
parent |
An optional parent |
field |
An optional |
Methods
get<T:h2d.Object>(n:String, ?c:Class<T>):Null<T>
Get an object from the prefab hierarchy by name. If the optional class c is provided, the returned object is verified to be of that type, returning null if it does not match. If c is not provided, the object is returned directly(unsafe cast).
Parameters:
n |
Name of the object in the hierarchy. |
|---|---|
c |
Optional class to enforce type checking. |