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

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

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

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

The Obsessive Shadow Remake is OUT NOW!!!!

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

A New Screnshot From My Friend Klawf

We went upstairs and found an onix.

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

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

Something is lurking down here... I feel it.

Game: https://gamejolt.com/games/deadwaters/1058536

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