using System.Collections; using System.Collections.Generic; using Unity.Burst.CompilerServices; using UnityEngine; public class Raycast2D : MonoBehaviour { Vector2 direction; void Update() { if (Input.GetKeyDown(KeyCode.R)) { RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.down, 100f); if (hit.collider != null) { print("Name: " + hit.collider.name); print("Tag: " + hit.collider.tag); print("Point: " + hit.point); } } } void OnDrawGizmosSelected() // Show in Editor { Gizmos.DrawRay(transform.position, Vector2.down * 100f); } }