- Home /
Best way to spawn new objects that arent already in the scene?
I'm making a simple top down space shooter and want to spawn in different objects/Enemies ect. For the enemies in the game, I placed one instance in the scene to begin with and the attached script keeps spawning new ones when needed. But with my power ups I'd rather just spawn one in through script without already having one instance in the scene(Like the enemies). So which method is the best practice? -Already having an instance in the scene that instantiate() 's objects of the same type OR -Having an empty game Object in the scene that holds all the scripts responsible for spawning new objects/Particle systems (Whatever else) when needed?
Answer by cdrandin · Aug 07, 2013 at 10:50 PM
I asked that same question. Here are the responses http://answers.unity3d.com/questions/509469/instantiate-vs-caching-gameobject-in-scene.html
So basically it really just depends on your situation? As in, in my case since the powerup in my game would be spawned less frequently compared to everything else it would be best to load it into the scene at run time? I'm trying to think more in terms of keeping everything really clean and organized as apposed to best performance since its not demanding at all to start with. I've gone ahead and used the load at run time method but what do you think?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
objects not reappearing 2 Answers
Distribute terrain in zones 3 Answers
Spawn object problem 1 Answer
Instantiate on value change 2 Answers