Jump to content

Deleting objects created with placeatme.


mercuito

Recommended Posts

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

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 by elseagoat
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...