Hey guys, I have a really strange problem. I need to spawn one object, after clicking on other object. I have 3 different objects, that spawns 3 different new objects, using this code:
But when i click on one of these objects, it’s spawns all 3 objects. And when i click on a spawned objects, they are also spawns themselves. You can see the result of only one click:
I need a help. I want, when clicked, only one object spawns and that copies can not spawn themselves. Thanks for help
The reason the cloned objects are also cloning themselves is because they also clone this script that you posted. If you want to avoid this you have a couple options:
Instantiate clones and disable the script component that is responsible for this: