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

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

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

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

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

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

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

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

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

In #BattleGemPonies we use a Threat Level indicator to gauge the power of ponies in the wild. #indiegame #ScreenshotSaturday

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