Answer the question
In order to leave comments, you need to log in
Why does the contact of colliders in one object work, but not in another?
Here it does not work, although if you change the tag to Wall, it works
void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == "EnergyDrink") // Проверка на столкновение с энергетиком
{
Debug.Log(123);
Destroy(col.gameObject); // Энергетик уничтожается
EnergyNumber += PlusEnergy; // Добавляется энергия
}
}
void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == "Wall") // Проверка на столкновение со стеной
{
if (Energy < 5) // Пока что пусть будет 5, потом поменяем
{
PlayCamera.SetActive(false);
UICamera.SetActive(true);
DeathPanel.SetActive(true); // Вызывание панельки смерти
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question