Answer the question
In order to leave comments, you need to log in
How to call a method from another script?
First (snippet):
public int hp = 100;
public int hpMax = 100;
void Update()
{
if (hp > hpMax)
{
hp = hpMax;
}
if (hp <= 0)
{
Die();
}
}
public void Hit(int damage) //хочу вызвать во втором скрипте, дабы обьекту с тегом и этим скриптом был нанесен урон
{
hp -= damage;
}
if (hit.transform.CompareTag("Gas tank"))
{
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question