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?

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

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

The Hive RTS RPG The swarm stops at the Great Wastelands to gather resources for the journey to the surface.

They don’t realize they’ve entered the holy gardens of the Chalatoi.

The offer is simple: join and become part of them… or be removed at once.

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

ANNOUNCEMENT

Now you can follow and wishlist #GrottoEscape on #Steam:

https://store.steampowered.com/app/3433190/Grotto_Escape/

A DEMO will be available for the Steam Next Fest in February 2026.

Grotto Escape will be released in March 2026 on Steam.

Watch a Proto Gameplay Teaser 20260111

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

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

#UnderwaterDiving 1.0.9 BUILD 22

You are an underwater diver surrounded by aggressive fish and minefields

USP: Energy <=> Life + Stamina + Oxygen

Watch 30s of #Gameplay 20260111

Available on #Steam:

https://store.steampowered.com/app/2178190/Underwater_Diving/

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