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

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

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

#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 20260213

Available on #Steam:

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

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

This is a random character on Route 954. This is in the Bleutopia region of the world. I'm going to be getting rid of this character in-order to add NPCs into the game.

#gamedev #unity3d #indiegame #indiedev #vroid #jrpg #unity #gamedevelopment

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

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

#GrottoEscape PROTO 0.7.0 WIP

Follow and wishlist 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 WIP Gameplay 20260214

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