using System.Collections; using System.Collections.Generic; using UnityEngine; public class DebugUI : MonoBehaviour { public bool debugMode = true; public GameObject debugUI; Ray ray; public RaycastHit hit = new RaycastHit(); // Start is called before the first frame update void Start() { debugUI.SetActive(debugMode); } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.A)) { debugMode = !debugMode; debugUI.SetActive(debugMode); } if (debugMode && Input.GetMouseButtonDown(0)) { ray = Camera.main.ScreenPointToRay(Input.mousePosition); GameObject selected_obj = null; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 200.0f)) { selected_obj = hit.collider.gameObject; Debug.Log("hit!!" + selected_obj.name); } if(selected_obj != null) { selected_obj.GetComponent().material.color = new Color(255, 100, 100); } } } }