I’ve noticed that when I try to spawn a component (using NewObject) and provide name of a component that already exists, then, instead of creating new component with the same name, engine returns me pointer to existing component.
In my case I’m dynamically spawning and destroying particle system emitters attached to objects.
It was quite easy to fix this, but it is a bit unexpected.
Is this by design? Does that mean that names HAVE to be unique? Also, does this only affect components, or should actor names be unique too?
Yes, if it was not the case names as IDs would be kind pointless and actor also have unique names (which you can see in Outliner) but that is dealt with seemlessly.
Also dynamic creation and removal of component is quite expensive operations, don’t you consider simple activation and deactivation of particule system in particule component? or swaping particule systems in existing component if needed?
Thanks for the info. So the purpose of the name is to serve as unique ID, got it.
Regarding creation/removal of components:
SpawnEmitterAtLocation does pretty much the same thing, and IIRC same applies to particle animation notifies. Either way, the operation is very infrequent, I highly doubt that would cause a problem.