How can I give copied objects a name?

Hi everyone,
I am making a 2048 game. I want to give the copies of the cuboid (a block that holds a value) I made in the game (the ones created by variables) names so that I can get their names later in the code to let them move around. Is that possible?
I tried to get the item using create string function of CoSpace Properties but it seems that properties cannot store items as it does not respond when I try to get the copied item by using CoSpace Properties.
I am looking forward for advice. Thank you very much.
Regards,
CoRichardLi

3 Likes

For sure @Luc @Alessio_Bonini or @techleapnz can help you with this.

I will follow this post to learn how to do it at your time.

Dani Yubero :slight_smile:

3 Likes

I think the best solution is to create a copy function with a parameter that is the new object (that now is also a variable), with this method you just need to use the command set the name of the object to…

3 Likes

Hi, @CoRichard_Li @DaniYubero!
Here is @Alessio_Bonini 's version in coblocks, click on the cube to copy it and it will change its name; I also think this is generally the best way to achieve this (you could even make the function have a return parameter with the item in order to store it in a variable); I also included a different way of doing the same thing, via direct reference to a variable; But I stand by that Alessio’s version is best practice:

Good luck on the game!

4 Likes

Thank you very much for your advice. I have successfully tried out the solution. Thank you for your help!

2 Likes