LS.Prefab Class
Prefab work in two ways:
- It can contain a node structure and all the associated resources (textures, meshes, animations, etc)
- When a node in the scene was created from a Prefab, the prefab is loaded so the associated resources are recovered, but the node structure is not modified.
Constructor
LS.Prefab
()
Item Index
Methods
addResource
(
-
filename
Adds a resource to the prefab
Parameters:
-
filename
Stringfilename of the resource
configure
(
-
data
configure the prefab
Parameters:
-
data
createObject
()
Creates an instance of the object inside the prefab
Returns:
object contained
Prefab.createPrefab
(
-
filename
-
node_data
-
resource_names_list
to create a new prefab, it packs all the data an instantiates the resource
Parameters:
-
filename
Stringa name for this prefab (if wbin is not appended, it will)
-
node_data
Objectan object containing all the node data to store
-
resource_names_list
Arrayan array with the name of the resources to store
Returns:
object containing the prefab data ready to be converted to WBin (it also stores _original_data with the WBin)
removeResource
(
-
filename
Remove a resource to the prefab
Parameters:
-
filename
Stringfilename of the resource
setData
(
-
data
assign the json object
Parameters:
-
data
Object | SceneNode