0
\$\begingroup\$

I use a prefab to generate several gameobjects which I then get rid of with the Destroy() function.

I noticed the clones, when destroyed are replaced with "New Game Object". Because of the nature of the game there would be thousands of these created throughout the course of the game.

Is this expected behavior, or is there something I'm perhaps doing wrong where the Destroy isn't really getting rid of it completely?

\$\endgroup\$
2
  • \$\begingroup\$ We need more details. When you destroy a game object it's gone. \$\endgroup\$ Aug 20, 2018 at 22:13
  • \$\begingroup\$ This definitely sounds strange. As Draco18s says, we should expect Destroy to remove the object entirely. Can you edit yout question to show us both your spawning & destroying code? \$\endgroup\$
    – DMGregory
    Aug 20, 2018 at 22:17

2 Answers 2

1
\$\begingroup\$

No, that is not a problem. That is just the default name for a run-time instantiated GameObject. If you want to name them, you can use myGameObject.name = "Something else";.

\$\endgroup\$
-1
\$\begingroup\$

Maybe you are not destroying the object, instead you are destroying the script, so be sure that you are calling the game object inside the Destroy function.

\$\endgroup\$
1
  • \$\begingroup\$ Please post answers only when you want to share a solution to the problem, not to circumvent the restrictions on commenting. I've removed the request for clarification, since that's already covered in the existing comments above, and focused on just the proposed fix. \$\endgroup\$
    – DMGregory
    Aug 21, 2018 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .