mercuito Posted February 27, 2013 Share Posted February 27, 2013 I want to be sure I am doing this correctly. I create an object via script with a placeAtMe function call.This created object is not a property of another script (however I set the return value of the placeAtMe call to a variable) So, when I want to delete the object I just call self.Disable() and self.Delete() on the object along with an UnregisterForUpdate() to be safe (I only use registerForSingleUpdate, so this is just a better safe than sorry check) Is this is enough? What else would one have to do to ensure a save game won't get cirrupted or (too) bloated? Thanks all. Link to comment Share on other sites More sharing options...
elseagoat Posted February 28, 2013 Share Posted February 28, 2013 (edited) I want to be sure I am doing this correctly. I create an object via script with a placeAtMe function call.This created object is not a property of another script (however I set the return value of the placeAtMe call to a variable) So, when I want to delete the object I just call self.Disable() and self.Delete() on the object along with an UnregisterForUpdate() to be safe (I only use registerForSingleUpdate, so this is just a better safe than sorry check) Is this is enough? What else would one have to do to ensure a save game won't get cirrupted or (too) bloated? Thanks all.The PlaceAtMe() function returns the last object reference that it creates. So, you call this function on another object reference like so: SpawnedObject = ObjectToSpawnSomethingElseOn.PlaceAtMe(ObjectToSpawn) Then to delete it: SpawnedObject.DisableNoWait()SpawnedObject.Delete() Calling a function on Self to remove a placed object with PlaceAtMe() would only work if the script calling Self.Delete() were actually attached directly to the object you spawned using PlaceAtMe() in a completely different script. Edited February 28, 2013 by elseagoat Link to comment Share on other sites More sharing options...
mercuito Posted February 28, 2013 Author Share Posted February 28, 2013 self.Disable() and self.Delete() is called on that placeAtMe()'d object, sorry for the confusion. Link to comment Share on other sites More sharing options...
Recommended Posts