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, его оружие и позицию рук относительно камеры!

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

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

This is what happens when rhythm meets the dungeon crawl. Welcome to GRIDbeat!

#indiegame #rythmgame

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

There's a developer debate over what color the decorative rim around the Crystal Stable interiors should be.

Which color for the background border looks best?

#monstertamer #gamedev #pixelart #feedback

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

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

One of the most important milestones for my indie game was to make it playable on Steam Deck.

And guess what! :P

#SteamDeckVerified #indiegame #gamedev

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