Game Development Community

Delete the object itself

by Till Hoffmann · in Torque Game Engine · 12/29/2005 (8:07 am) · 1 replies

I want to delete a button if it gets clicked. So I tried this:
%obj = new GuiButton(myButton)
{
 extent=...;
 ...
};
%obj.command = %obj@".delete();"

But I get an error: access violation

I thought about using schedule but I think there are better ways

#1
12/29/2005 (9:29 am)
Actually, using schedule with a 0 millisecond delay handles the timing issues that are normally a problem with this type of "instantaneous" deletion. It's actually a pretty good technique!