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?

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

We spoke with our Level Designer about how he's building the fictional midwest town in Usual June!

Read his interview right here: https://store.steampowered.com/news/app/2702430/view/53100139783…

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

Void step steam page is live!

Wishlist NOW: https://store.steampowered.com/app/4589000/Void_Step

You are a runner in a neon void. The silent world pulses once again to the music you bring. Race against time, against gravity, against everyone else.

#screenshotsaturday #gamedev

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

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

#GrottoEscape DEMO PROTO 0.43.0 AVAILABLE

Follow and wishlist on #Steam:

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

Grotto Escape will be released in April 2026 on Steam.

Watch a WIP Gameplay 20260415

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