How to create multiple unique objects with instantAddObject ?

For an exploding object, I have a script that ends the destroyed object and uses instantAddObject to add a few new, smaller objects from another layer.

The problem is that each one of the new objects has the same name and ID (according to console output).

So, in another script when I try to set a targeted object’s Property with ray.getHitObject(), the Property of all objects with the same name are changed instead of just one.

There is also a sensor watching this Property value, so changing one object sets off the IPO effect on all the objects with the same name, instead of just the single targeted object.

I’ve been searching through the old discussions to find something that could help, but I haven’t been able to find it yet.

If I can’t create a unique object name with AddObject, is there anyway to rename each duplicate object with a new, unique name? Is there something like setName()?

Or is it possible to just create on object with AddObject, then somehow make a few copies that auto-increment their object names (like Shift+D)?


fun with bge

Thanks for your help.

P.S. I also have a couple other open questions in these two threads and I’d appreciate any advice:

On-screen position script question

How to end an actuator?

Is it possible to end an actuator (playing a loop) by changing to another state layer? Or does the state only affect sensors and not current actuator values?