Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: unloading an object  (Read 2872 times)

0 Members and 1 Guest are viewing this topic.

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
unloading an object
« on: September 23, 2008, 03:25:20 PM »

I am loading several object using the new method :
Code: [Select]
var MyObject = new Object("script_filename");

when i unload them, nothing happens, they stay in memory and i still see them in the debugger.

Code: [Select]
Game.UnloadObject(MyObject);
Is it a WME bug ?

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: unloading an object
« Reply #1 on: September 23, 2008, 03:44:13 PM »

No, UnloadObject only works for native WME objects. Your custom objects created with the "new" operator are garbage collected, i.e. they are destroyed as long as nothing references them anymore.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Re: unloading an object
« Reply #2 on: September 23, 2008, 03:48:18 PM »

would they be collected if i set this :
Code: [Select]
MyObject  = null;

Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: unloading an object
« Reply #3 on: September 23, 2008, 05:05:44 PM »

Yes, as long as the object isn't referenced elsewhere.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SoundGuy

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 196
    • View Profile
Re: unloading an object
« Reply #4 on: September 24, 2008, 07:17:20 AM »

It works ! Thanks !
Logged
 

Page created in 0.076 seconds with 20 queries.