Creating an NRaas project Difference between Destroy and Dispose?
- icarus_allsorts
- Reactions:
- Posts: 213
- Joined: March 8th, 2012, 6:00 pm
Difference between Destroy and Dispose?
Specifically when it comes to a GameObject, it seems that in most cases where you'd want to get rid of an object Destroy is the go to method, but there does also seem to be some important-ish looking code in DIspose that would seem odd if it was never run on the object being destroyed. I guess my main question would be does Dispose() perhaps get used somewhere along the line after Destroy() runs?
- Chain_Reaction
- Site Admin
- Reactions:
- Posts: 7620
- Joined: December 30th, 2011, 6:00 pm
- Contact:
Destroy seems to only be useful when you want to remove the object from the world/simulator but not actually kill it's data structure (such has destroying a Sim object during hibernation). Dispose is when you want it to die. Generally I do both when getting rid of things. It appears EA is a big fan of destroy which is why ET is needed to actually get rid of the data using dispose.
- igazor
- Organizer
- Reactions:
- Posts: 17151
- Joined: April 8th, 2013, 6:00 pm
- Location: Everyone should strive to find their inner platypus.
Without meaning to, and without even asking a non-coder to participate over here, you guys have just solved a weird mystery for me that I had been saving to present some day. I have a screenshot taken in Edit Town at the precise moment an NPC babysitter left the lot where he was working, was on his way who knows where (home, off the map I suppose), and Tagger was reporting his current action as "Destroy Myself."
Am pretty sure players weren't really supposed to ever see that, but at least now I know what it meant, and it wasn't nearly as sad as I thought!
Am pretty sure players weren't really supposed to ever see that, but at least now I know what it meant, and it wasn't nearly as sad as I thought!
- Chain_Reaction
- Site Admin
- Reactions:
- Posts: 7620
- Joined: December 30th, 2011, 6:00 pm
- Contact:
- icarus_allsorts
- Reactions:
- Posts: 213
- Joined: March 8th, 2012, 6:00 pm
- Chain_Reaction
- Site Admin
- Reactions:
- Posts: 7620
- Joined: December 30th, 2011, 6:00 pm
- Contact: