Spawning and removing collection

Hi, at the start sorry for my english.

I am confused about how the collections works. I wanted to spawn enemies and enviro assets into different collections and remove all at the same time (something like add/remove whole map).
If the object has render visibility turned off - it’s still on the scene with enabled traits and collision (but it’s invisible). I know it is possible to add RB and Traits after spawning an object and move it to the collection, but sometimes it doesn’t work properly.

I found the solution, but have no idea if it is the best one.
Every object has a “Spawn” property, but if idisabled it cannot be spawned using the “spawn object” funcion.

This is my NodeTree (It works):

  1. Creating collection for the enemies called EnemyColl.
  2. Spawning Enemy collection (for example: rigid body, armature and model) and moving it to EnemyColl.
  3. Removing all objects inside EnemyColl and refreshing collection. Remove Object doesn’t removing values inside collection array (objects data are still there). It’s possible to use Remove Object from Collection node but it’s reseting Array Loop every time when array is changed (probably index issues). Removing and creating new collection is faster.

Is my solution right or is there a better way?

2 Likes

Hello, welcome to the forum. Works nicely and is simple. I think you hit the nail. Thanks for sharing.