update
This commit is contained in:
22
spawn_from_scene/Sources/lnx/MyTrait.hx
Normal file
22
spawn_from_scene/Sources/lnx/MyTrait.hx
Normal file
@ -0,0 +1,22 @@
|
||||
package lnx;
|
||||
|
||||
import iron.Scene;
|
||||
import iron.object.Object;
|
||||
import iron.data.Data;
|
||||
import iron.data.SceneFormat;
|
||||
|
||||
class MyTrait extends iron.Trait {
|
||||
public function new() {
|
||||
super();
|
||||
notifyOnInit(init);
|
||||
}
|
||||
|
||||
function init() {
|
||||
Data.getSceneRaw("Scene.001", function (raw:TSceneFormat) {
|
||||
var obj = Scene.getRawObjectByName(raw, "Suzanne");
|
||||
Scene.active.createObject(obj, raw, null, null, function(o:Object) {
|
||||
trace("Suzanne spawned!");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user