I am making jumping game and I have a problem.(I am using Unity 4 and 2D Toolkit.) I have a 3 sprite in scene.First layer, second shaman(main character), third gold. I want to collision shaman and gold.When shaman touched gold, I want to destroy gold.
Here is the code:
void OnTriggerEnter(Collider collision)
{
Destroy(collision.gameObject);
if (collision.gameObject.tag == “goldshaman”)
{
Destroy(gameObject);
}
}
I made a shaman tag is goldshaman and shaman and gold is own to sphere collider. Also is trigger marked.(gold and shaman). Shaman and gold is same z axis.Gold is moving and touched shaman but shaman is not destroy.
Simply can’t work why?
Please help guys.