We are developing an economic sandbox somewhat similar to a mixture of The Guild and Kenshi.
In this game, both the player and the NPCs will often create and destroy (consume) various objects.
The trouble is that destroying an object in Unity does not remove references to destroyed objects. For example, Lists containing the object will still contain an entry for it (that compares as equal to
The best solution I came up with is to use the observer pattern, notifying all classes where the object was stored about its destruction and removing references to it from there. But this method does not look optimal; are there better options?