I’m trying to create a script to move my character to a point on the terrain that works with NGUI because currently I am using a script along with NGUI and it is causing me issues.
void rayCastClick()
{
if (Input.GetButtonDown("Mouse0"))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, 100))
{
if(hit.collider.gameObject.tag == "Terrain")
{
//Take hit point and move to hit position on terrain
}
}
}
}
}
Can anyone give me an example of how I would do this using NGUI’s event system? I’m not sure how to do it.