Sprite Identification

Hi, there is some Sprite Identification?
Currently I am using sprite.__instanceId, but it looks like a private property and that can change any time.

Thanks.

Hi, @mateusbrum

You can use tag to identify them

sprite.setTag("id1");
parent.addChild(sprite);
// This will get the sprite
parent.getChildByTag("id1");

Huabin

1 Like

Good, but with such technique I must control identification, there is another option ??
Thanks…

@mateusbrum wrote:

Good, but with such technique I must control identification, there is another option ??
Thanks…

Could you please explain what you are trying to do a little better?

I have a hash with a lot of sprite - wich will be removed - they are identified by this __instanceId. So how do I explained earlier it looks like very brittle.
I don’t wanna control identification index by hand, for example a static counter or something else.
Thanks…