hi…i am new to unity…i have a banana prefab tagged as “ban”. now have a problem with collider that is a trigger. i written a score system program on it and it works good.but, the problem is that i duplicated the object which has same tag.when i collide with my player the original of the banana prefab increases the score…but not duplicated prefabs increasing it.
i am using this script on that prefab :
public void OnTriggerEnter(Collider hit)
{
if (hit.gameObject.CompareTag("player"))
{
sc += 5.0f;
score_value.text = ((int)sc).ToString ();
Destroy (this.gameObject);
}
}
Is there any solution for this? (please…it’s urgent )!!!