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

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

Вот это я понимаю, дробовик! Бабахнул и пол вселенной снесло! Вообще, в последнее время заглядываюсь на Wolfenstein, его оружие и позицию рук относительно камеры!

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

These are the enemies in our game #CultofBlood. Show me yours!

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

ANNOUNCEMENT

Now you can follow and wishlist #GrottoEscape on #Steam:

https://store.steampowered.com/app/3433190/Grotto_Escape/

A DEMO will be available for the Steam Next Fest in February 2026.

Grotto Escape will be released in March 2026 on Steam.

Watch a Proto Gameplay Teaser 20260112

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

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

⚡ Bow’s powers are charging up for the next chapter of High School Hills! ⚡

🎮 Wishlist or try the demo now:

https://store.steampowered.com/app/3960230/High_School_Hills_Dre…

#IndieGames #PixelArt #GameDev #IndieGameDev #IndieDev #unity

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