How to Destroy in Infinite Instantiate in unity ?
How to Destroy in Infinite Instantiate in unity ?
To destroy objects that you have instantiated in an infinite loop, you can use a similar approach. First, you will need to store a reference to the objects that you have instantiated in a list or array, and then you can use a for loop to iterate over the list and destroy each object. Here is an example of how you could do this:
Keep in mind that destroying objects in this way can impact performance, especially if you are instantiating and destroying a large number of objects. It is generally best to reuse objects instead of constantly creating and destroying them. You can do this by using object pools, which allow you to create a set of objects at the start of the game and then recycle them as needed instead of constantly creating new objects. This can improve performance and make your game more efficient.
Post a Comment
image video quote pre code