show Debug.Log in UI
Hello friends This code has a problem show Debug.Log in UI or NGUI please help thanks //========================================= using UnityEngine; using System.Collections; using UnityEngine.UI;
public class Pic_ObjectUi : MonoBehaviour { public GUISkin Skin; public string StringToEdit1; public string textAria; private Object colly; private float dist;
void Start()
{
}
void Update()
{
if (Input.GetMouseButton(2))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 100))
{
Vector3 orto = hit.normal;
float dist = hit.distance;
Collider colly = hit.collider;
hitObject = colly.gameObject;
Debug.Log("Hit! Distance " + dist + " from " + colly.name);
}
else
{
hitObject = null;
}
}
}
void OnGUI()
{
GUI.skin = Skin;
if (hitObject != null)
{
if (hitObject.GetComponent<O-bjectData>() != null)
{
ObjectData data = (ObjectData)hitObject.GetComponent<O-bjectData>();
GUI.color = Color.yellow;
StringToEdit1 = GUI.TextField(new Rect(270, 73, 40, 40), (data.description).ToString());
textAria = GUI.TextArea(new Rect(10, 100, 20, 20), ("Hit! Distance " + dist + " from " + colly.name).ToString());
}
else
{
GUILayout.Label(hitObject.name);
StringToEdit1 = GUI.TextField(new Rect(270, 73, 40, 40), (hitObject.name).ToString());
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to choose a specific item from “ScrollRect” by pressing “button”? 0 Answers
Unity view on top of iOS view 0 Answers
No outline of UI components in Scene View 1 Answer
My project's UI keeps resizing itself and I have no idea why. 0 Answers
Problem trying to animate UI elements on different screens 0 Answers