Delete item (created in loop) when click



I have a simple program that does the following : In a repeat loop,

(1) makes copy of a bird
(2) when clicked bird disappears.

When I repeat the loop, it seems that the last bird is deleted regardless of which bird I clicked.
Any suggestions?


Hi @andrea_sung,

currently there is an issue with CoBlocks variables used inside block events within functions. Contrary to parameters, variables in CoBlocks are global, that means that the bird you delete with the click-event is always the last bird reference you created. We’re looking into making this behaviour more clear to you while preventing this issue to come up again :slight_smile:

Here’s a solution to your problem. Instead of creating targets & binding their click-events in one function, we split these steps in two separate functions instead. We also change the itemName string parameter to a SceneItem parameter.


Hi Stefan,

I was expecting the variable “bird” to be local in the function. Thanks for your reply, it’s clear now that I know the variables in CoBlocks are “global” but parameters are local with the function.