오브젝트 선택창

This commit is contained in:
SullyunShin
2025-05-12 18:00:37 +09:00
parent d8c606fe6a
commit 8a1902d80d
30 changed files with 2625 additions and 1723 deletions

View File

@@ -0,0 +1,28 @@
using UnityEngine;
public class ClickHighlight : MonoBehaviour
{
public Material highlightMaterial; // 반투명한 머터리얼
private GameObject highlightBox;
public void ShowHighlight(BoxCollider target)
{
if (highlightBox == null)
{
highlightBox = GameObject.CreatePrimitive(PrimitiveType.Cube);
Destroy(highlightBox.GetComponent<Collider>()); // 충돌 제거
highlightBox.GetComponent<MeshRenderer>().material = highlightMaterial;
}
highlightBox.SetActive(true);
highlightBox.transform.SetParent(target.transform);
highlightBox.transform.position = target.transform.TransformPoint(target.center);
highlightBox.transform.rotation = target.transform.rotation;
highlightBox.transform.localScale = Vector3.Scale(target.transform.lossyScale, target.size);
}
public void HideHighlight()
{
if (highlightBox) highlightBox.SetActive(false);
}
}