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

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

Заменил еще скай бокс

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

Cult of Blood will be featured at the GIG Showcase organized by GELIUS. Streaming live on January 5th, 2026 at 7 PM CET on YouTube. #indiegame #gamedev

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

Happy 2026 everyone, and as the first post of this year I will post these 2 server models.

Ура! Канал ожил! https://t.me/GRRRRRROB Господа и дамы, прошу!

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

Take a look at all your Battle Gem Pony facts & figures on the Stats screen! (Here's a snapshot of what the menu looked like in 2015 vs now 📸)

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