Question how to delete only one clone of a game object

Joined
Jul 7, 2014
Messages
1
Programming Experience
Beginner
I am developing an android math game it involves the use of coin with a value on it. i am wondering wondering what will i do in order to delete
only one object in my game

for example if i have coin1(clone) and coin1(clone)(clone)..

if i click coin1(clone)(clone) it will be destroyed. but in my case
, when i click coin1(clone)(clone), coin1(Clone) is deleted, i was wondering what will i do in order to delete only one object.
PS. the game object has a same value on it

void NumberOfSelectedCoins()
{
Debug.Log (BlueCoinScript.b);
if(SelectedCoins.cntCoins%BlueCoinScript.b == 0)
{

for (int n=0;n<selectC.selectedNumCoins.Count; n++)
{
Destroy(selectC.selectedNumCoins[n]);
TotalSum.totalValue = 0;
SelectedCoins.breakPointsCount++;
}
breakpointsText.text = SelectedCoins.breakPointsCount.ToString ();
selectC.selectedNumCoins.Clear();
}
}

also if you have 1 game object and you cloned it so that you can have 3 same game objects,
how can you identify that when you clicked that game object, that game object is clone1 or clone2 or clone3

thx for the help
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,151
Location
Sydney, Australia
Programming Experience
10+
You have succeeded in making your code harder to read. In future, please just paste it as plain text within code formatting tags, e.g.

[xcode=c#]your code here[/xcode]

As for your question, are you sure that these alleged clones are actually distinct objects and not just multiple references to the same object?
 
Top Bottom