Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: robot on October 10, 2010, 12:04:36 PM

Title: Error after Game.DeleteEntity()
Post by: robot on October 10, 2010, 12:04:36 PM
hi there  ::wave

i have a problem here (maybe it is a bug):

in a script a sprite entity will be deleted with Game.DeleteEntity("entity1");
after that the error occurs at this command: Scene.getNode("obj");

the order of the objects in the sceneEdit is following:

...
entity
entity1
entity2
object
...

it is interesting that the error doesn't occur when i place the "object" before the entities:

...
object
entity
entity1
entity2
...

has it something to do with the z-order?
it is realy confusing!
Title: Re: Error after Game.DeleteEntity()
Post by: Andrej (Blue Arc) on October 10, 2010, 04:54:09 PM
Are you sure you are using Scene.getNode("obj"); instead of right syntax Scene.GetNode("obj")?
Title: Re: Error after Game.DeleteEntity()
Post by: robot on October 11, 2010, 06:40:21 PM
yes, the syntax is correct.
it seems that i can not call objects that are after the deleted entity.
hmm, when there isn't a solution i think i have to inactivate them and not to delete them...
Title: Re: Error after Game.DeleteEntity()
Post by: metamorphium on October 12, 2010, 12:04:51 AM
is the script attached to the entity, you're deleting?
Title: Re: Error after Game.DeleteEntity()
Post by: robot on October 14, 2010, 07:29:52 PM
hi! thanx for your answer.
yes, the script is attached to this entity. but the delete command is the last command in this script...
and the error occurs later in an other script. maybe its a little to much scripts involved there so i made another test
and i can reproduce the error:

i created a new scene with one entity object and a region.
in the scene_init script i added following code:

Code: [Select]
var t = Scene.GetNode("obj");
t.Active=false;
Game.DeleteEntity(t);

Scene.GetNode("region1");

it crashes in the last line...