mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 15:07:22 +02:00
switch from Unity version control to git
This commit is contained in:
25
Assets/ObjectSelector.cs
Normal file
25
Assets/ObjectSelector.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ObjectSelector : MonoBehaviour
|
||||
{
|
||||
public static GameObject selectedObject;
|
||||
|
||||
void Update()
|
||||
{
|
||||
Debug.Log("Selector is running");
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
if (Physics.Raycast(ray, out RaycastHit hit))
|
||||
{
|
||||
Debug.Log("Hit: " + hit.collider.gameObject.name);
|
||||
if (hit.collider.CompareTag("Selectable"))
|
||||
{
|
||||
ObjectSelector.selectedObject = hit.collider.transform.root.gameObject;
|
||||
Debug.Log("Selected Root Object: " + ObjectSelector.selectedObject.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user