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

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

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

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

Sometimes, survival comes down to the blade in your hand.

Steel against the cult ⚔️

#indiedev #gaming

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

Senior Sunset is out now.

After 6 months of development I'm happy to announce that Senior Sunset can now be downloaded for free on Steam!

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

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

Embark on an exploration adventure with spooky and horror elements, tasked with recovering real historical artifacts from excavation sites around the world.

Play the free Demo now on Steam:

https://store.steampowered.com/app/1924470/Cursed_Dungeon_Raider…

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