kubuto2
|
  |
| Joined: 16 Jul 2008 |
| Total Posts: 1275 |
|
|
| 07 Jan 2014 04:37 PM |
Remove sets the object's parent to nil anyways and destroy wipes the object from the game.
Which one is more efficient to use?
I ask this, because creating a mass of objects creates less lag than destroying the same amount of objects.
Removing and setting the parent to nil is the same thing, from that I would like to know if a method is better than changing the value of an object. |
|
|
| Report Abuse |
|
|
| |
|
kubuto2
|
  |
| Joined: 16 Jul 2008 |
| Total Posts: 1275 |
|
|
| 07 Jan 2014 04:58 PM |
Would if I would like to set an object to nil?
Would Remove() or setting the property of parent be better? |
|
|
| Report Abuse |
|
|
bezgar
|
  |
| Joined: 19 Dec 2013 |
| Total Posts: 4 |
|
|
| 07 Jan 2014 04:58 PM |
| I don't think :destroy() wipes the object from the game. It just locks the parent property. The 'Name' property etc can still be read. Doesn't this mean it still exists? |
|
|
| Report Abuse |
|
|
bezgar
|
  |
| Joined: 19 Dec 2013 |
| Total Posts: 4 |
|
|
| 07 Jan 2014 05:03 PM |
| and I think :remove() would be faster since it's C++ (citation needed). |
|
|
| Report Abuse |
|
|
| |
|
HaxHelper
|
  |
| Joined: 19 Dec 2009 |
| Total Posts: 1208 |
|
|
| 07 Jan 2014 05:08 PM |
depends on what you want to do with it after
brush up on your methods pls |
|
|
| Report Abuse |
|
|
Aerideyn
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 1882 |
|
|
| 07 Jan 2014 06:25 PM |
Destroy() Remove() from your mind. it is depreciated and you should not use it.
Your 2 options are then as follows:
Destroy() Will delete the object and all of it's children and will lock any further access to them. Once it's gone it is gone.
Parent = nil Removes the object from the game, but the object will hang around until there are no more references to it. If you have a reference to that object in a table for example and never remove that entry - the object will never be cleaned up. This could be what you want - or it might not be.
|
|
|
| Report Abuse |
|
|
suremark
|
  |
| Joined: 13 Nov 2007 |
| Total Posts: 6315 |
|
|
| 07 Jan 2014 06:37 PM |
http://wiki.roblox.com/index.php/User:JulienDethurens/Essays/Removing_objects
This is a good article about different methods of removing instances. |
|
|
| Report Abuse |
|
|