A
A
Armyashka2020-04-20 21:29:43
C++ / C#
Armyashka, 2020-04-20 21:29:43

Why doesn't the beam read the character's tag?

RaycastHit2D knif = Physics2D.Raycast(transform.position, Vector2.up);
  if (knif.collider != null && knif.collider.CompareTag("Player"))    
  {
       Debug.Log("Test");
  }

5e9de974ea950157268151.png
Moreover, without this condition, a test message is displayed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-04-20
@GavriKos

Well, and print out what the beam rested on - stupidly the name of the object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question