Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


raycasthit2d

This is an old revision of the document!


RaycastHit2D can be used in an if statement to tell if the raycast hit anything, or if it hit nothing.

Example:

RaycastHit2D hit = Physics2D.Raycast(someStartPoint, someDirection);

if(hit) {
    Debug.Log("yaaay I hit something!");
}
raycasthit2d.1620197842.txt.gz · Last modified: 2021/05/05 06:57 by andrew900460