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

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

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

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

Alongside trading and talking, each town has quests you can take for rewards and reputation! 🪙

At Driplands, Blubbie can ask you to fetch some materials for her designs, guide some tourists to far-away landmarks, or to take some cool, fun shots! 📸

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

I made a short game about known meme cats! 😽 Explore a strange world full of cats and uncover what happened to the missing cats from your village. You can give it a try! https://gamejolt.com/games/micegame/1019835

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

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

#NinjaScroller 1.61.7 BUILD 48

With DOUBLE JUMP & QUICK FALL ATTACK!

A challenging Pixel Art #ActionRunner game with a Retrogaming vibe

Watch 30s of #Gameplay 20250911

Available on #Steam:

https://store.steampowered.com/app/2150800/Ninja_Scroller/

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