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?

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

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

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

Timelapse - Industrial Pipes Modular Series FacilityFactoryKit - G1-N1. Cycles Low Samples. #b3d,#blender,#unity,#pipes,#pipeline,#props,#gas,#industrial,#industry,#game,#assets,#3d,#pipesmetal,#metal,##valves,#key,#pipevalves.

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

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

Welcome to the world of Sombo. it is an open-ended physics sandbox designed for players who love to experiment, build, and break things. Built with a heavy focus on player freedom and a distinct aesthetic, it’s a space where your creativity, Try it out !

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