Mounting a Spawner to a SceneObject does not function as expected.
by Scott Cameron · in Torque X 2D · 03/21/2010 (10:27 am) · 2 replies
When mounting a SpawnObject to a moving SceneObject in TXB it seems to mount only a Clone of the SpawnTemplate and not the actual spawner itself.
What I would expect to happen would be to have the spawner mounted to the moving object spawning the SpawnTemplate every so often but this does not happen.
I've tried all combinations of SpawnEnabled and SpawnOnce but no matter what I tried it doesn't continue to spawn objects.
Repro:
1) start a basic game project
2) crate a simple asset to spawn.
3) start TXB and open your project
4) crate the SpawnTemplate
5) create a spawn object and a blank scene object.
6) assign the template to the spawner and mount the spawner to the blank scene object.
7) setup some type of movement on the blank scene object.
8) run the game
Results:
the blank scene object only spawns 1 of the template and never spawns more.
Expected:
the spawner continues to spawn objects from the scene object as it moves.
What I would expect to happen would be to have the spawner mounted to the moving object spawning the SpawnTemplate every so often but this does not happen.
I've tried all combinations of SpawnEnabled and SpawnOnce but no matter what I tried it doesn't continue to spawn objects.
Repro:
1) start a basic game project
2) crate a simple asset to spawn.
3) start TXB and open your project
4) crate the SpawnTemplate
5) create a spawn object and a blank scene object.
6) assign the template to the spawner and mount the spawner to the blank scene object.
7) setup some type of movement on the blank scene object.
8) run the game
Results:
the blank scene object only spawns 1 of the template and never spawns more.
Expected:
the spawner continues to spawn objects from the scene object as it moves.
#2
03/23/2010 (7:47 pm)
Ok so I was right this is a bug in the builder/serializer which hopefully will get fixed with the next 2D builder release.
Associate Giuseppe De Francesco
DFT Games Ltd
that's a problem with the XML deserializer (many problems actually). Your scenario won't work only if you mount the spawner in the builder.
If you do your mounting after the scene has been loaded all works as expected (put your mounting code in the OnSceneLoaded delegate). I'm looking into the XML classes but those are a low prioroty for me now... ;)