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

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

Ну и на последок улучшил немного графон

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

Assault on the Demonic Realm is a fps boomer shooter game. #fps #boomer #shooter #action

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

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

Available on #Steam:

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

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

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

Want to play the Closed Alpha? Support Cursed Dungeon Raider on Patreon!

https://www.patreon.com/cw/CursedDungeonRaider

Get access to closed alpha builds, deep lore and technical insights like our recent NPC realism showcases. Join the expedition today!

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