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?

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

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

Every biome has its own rules. Its own mood. Its own way to kill you!

#gamedev #screenshotsaturday

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

Gameplay of level 4, again, but this time with the new skill.

Read the article...

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

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

TimeLapse - Bottles Series Equip Drink Container G1 - N1-3 Cycles - Low Sample. #b3d, #blender, #unity,#equip,#drink,#bottles,#container,#can, #reservoir,#liquid, #cycles,#props,#assets,#industrial,#industry.

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