- Home /
How do you efficiently target many instantiated prefabs for tweening?
Hi, I'm making a top a down shooter styled game and I haven't been able to find the answer to my question. Basically I need 15+ enemies on the screen at once spawning from different locations and each enemy will need to follow a path. The way that I was going to do it is by creating many game objects and creating a path on each one, and then have the enemy spawn on it and follow the path of the gameObject it spawned on. The problem is that I have no idea how to make this happen because I'm unsure of how to efficiently target an instantiated object, especially when there will be clones of the same object spawning fairly quickly after the initial instantiated enemy. My plan was to have all of these empty game objects with their defined paths and then use a single script called level1, level2, level3 etc on an empty game object that's the parent of all the path game objects to instantiate enemies at different positions. How do I target each of these instantiations efficiently? I'm sure you could instantiate each prefab as a gameObject with an individual name or ID and then target each one with a tweening function on the main level script, but that seems like it would be awfully messy and inefficient to me. There's not a target platform for sales but it would be cool if it was quick on a phone so I'm trying to be efficient about it. Thanks for your help in advance!
Your answer
![](https://koobas.hobune.stream/wayback/20220613134554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
One big script or lots of small ones? 0 Answers