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

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

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

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

3 days remain! (Video by DaBoiDownUnda)

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

Ah well. It's been eight months or so since the last upload here, which means you get another spoonful of content. Recently I have done the impossible at last: finished a character design! Two of them, actually. Oh, and I wrote a silly shader. Enjoy.

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

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

New fighting move in the works. Feedback welcome.

#gamedev

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