First Commit

This commit is contained in:
2025-05-18 22:39:39 +03:00
commit 042ede7228
440 changed files with 103153 additions and 0 deletions

54
Assets/CheckOutlines.cs Normal file
View File

@@ -0,0 +1,54 @@
using UnityEngine;
public class CheckOutlines : MonoBehaviour
{
[SerializeField] private Camera cam;
[SerializeField] private float rayDistance = 100f;
Outline2 outline;
void Start()
{
if (cam == null)
cam = Camera.main;
}
void Update()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit, rayDistance))
{
var outlineTemp = hit.collider.GetComponentInChildren<Outline2>(true);
if (outlineTemp != null)
{
if (outline != outlineTemp)
{
if (outline != null)
outline.Alpha = 0; // Reset previous outline
outline = outlineTemp;
outline.Alpha = 1;
Debug.Log("Detected object with outline: " + hit.collider.name);
}
}
else
{
if (outline != null)
{
outline.Alpha = 0;
outline = null;
}
}
}
else
{
// Raycast hit nothing <20> reset outline
if (outline != null)
{
outline.Alpha = 0;
outline = null;
}
}
}
}