How to fill Lists of Classes automatically?,How to fill Lists of a Class automatically?

Hi, I want to fill the List public List Boids boidsInScene with every Object how should behave like a Boid.
For now I have to insert for every single object every other object manually to the list. (Only for a small amount of Objects there are exponentially many lists I have to fill.
My question is if there is an option how to fill this list automatically, i.e. that every object I insert automatically has this List filled with every other Object i have already created.
Thanks for any help :slight_smile:

,Hi, I have a question how to fill the list "public List boidsInScene;?
When I create a 3D Gameobject with the Script “Boids” and then create a Prefab which I then drag several into the scene, then I have to insert for every single one of them every other object into the list manually. Is there a way how I can fill the List for every Object automatically?
Thanks for any help :slight_smile:

Well, you can simply drag all at once onto the array / list in the inspector which would add all of them to the end of the list / array. For this you would need to lock the inspector on the object that contains the script with the list. Once the inspector is locked, you can simply select all the instances (CTRL or SHIFT or rubber band select, whatever) and drag them all at once onto the array itself in the inspector. This will expand the array by the number of dragged objects and insert them into the list. Once you’re done you can unlock the inspector. Here’s an old gif I created years ago.