- Home /
Some objects are not destroyed/instantiated
In my update loop I have a procedure, that runs through my octree. During that run, a lot of Instantiate() and Destroy() calls are made. The problem is that due to unknown reasons, some objects sometimes are not destroyed or instantiated. This happens more often when object count that needs to be destroyed or instantiated is high (10-20 in one update loop). What could be the reasons of that "missed" objects? Is there a way to ensure that all objects that should be destroyed/instantiated are destroyed/instantiated before running next update loop?
Can you show us some code please? Sounds like you could have some race conditions perhaps?
When I do large looping operations such as instantiating or destroying large numbers of objects I do it in a coroutine.
you need to provide more details or code, how are you looping over your objects?
Jeremy, what do you mean by race condition? The code is rather huge, I don't think it will clear things up, actually
A race condition is when two (or more) functions directly effect the outcome of one another when run at the same time causing one (or more) functions to work and one (or more) not to work as expected. They can be hard to spot if they become engrained deep in your code.
Your answer
Follow this Question
Related Questions
Hi,Please i need help comparing conditions in the Update Function 1 Answer
Objects Instantiated in a Loop Problem 1 Answer
How do I Instantiate a prefab to touch and still update a score? 1 Answer
Multiple gui instantiation issues 0 Answers
GameObject instantiates too many objects in update 2 Answers