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?

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

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

In our upcoming action adventure game Usual June, we're trying to keep the combat frantic, flexible, and fun!

👻 Wishlist Usual June on Steam to keep updated on its development: https://store.steampowered.com/app/2702430/Usual_June/

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

Sit by the fire, it'll be alright.

Making some progress on #RUMOUR! Currently working on the props and lighting of the Secretary Room.

Based on the incredible concept art made by @templeofevil_

#gamedev #horrorgame #videogame #indiegame #retro #ps1 #psx

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

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

Beary had trouble defeating Yellow Jacket, can you help him? 🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺🥺

RBA 1.0 releases Jan 27th 2026 on Steam, Xbox, and Epic! #videogames #indiegame #indiegamedev #gamedev #xbox #steam #epic #epicgames #cute #pixelart

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