3 years ago

Hi everyone! I have one little problem.


I have 2 scripts: one for bullet and one for enemy. In EnemyController, there are function:

public void TakeDamage(int damage)

{

_health -= damage;

}

and I call it in script for bullet

if (hitInfo.collider.CompareTag("Enemy"))

{

hitInfo.collider.GetComponent<EnemyController>().TakeDamage(damage);

}

Unity says me, that it is error CS0103: The name 'damage' does not exist in the current context.

Why?



2 comments

Loading...

Next up

Елки-палки! Надеюсь, я когда-нибудь это доделаю!

Ну и на последок улучшил немного графон

Ну, тип один из скримеров для моей короткометражки для задания по режиссуре. Ну да

When your weird Alien colony building game hits 10,000 wishlists in 10 days ❤️ https://gamejolt.com/games/TheHive/255022

Вот, представляю вам: Тюленьи Когти!

USS Eldridge 1, the first ship that went into the twilight zone and never came back.

#pixelart #scifi

Happy #screenshotsaturday !

Как вам ендокий UI?

Ну, с Хэллоуином)

Yall thought the OST for the crab battle was good now listen to this banger

Game: https://gamejolt.com/games/deadwater/1016100

Дополнение на тюленьи когти, добавляющее альтернативную атаку: Мелкий выстрел, замедляющий противника на пару секунд