Use Entity after EntitySet released

Hi,

Is it safe to keep using an Entity object after its EntitySet is released?

All the changes (set/get components) to Entity afterward will happen only from a single place. (inside an AI script)

A bit of context: No game system is meant to listen for changes, in this case, as a convenience method I just thought I can load the required data from the database at the app start via ed.getEntities() and then throw the EntitySet away and just keep a reference to Entity object (inside an AI script) as a component container for future reading and writing changes to a memory buffer that also auto persisting the changes to the database under the hood.

From a quick look at the source code I do not see releasing an EntitySet would corrupt its Entity, but just wanted to ask it here to be sure!

It should be ok.

…just don’t forget that those entities are disconnected later when you try to wonder why they aren’t updating when component X changes. :slight_smile:

1 Like

Yeah, as I am going to read and write from Entity from the same place, that should not be a concern.