u can use this
if( Physics.Raycast( ray,out hit) )
{
if(hit.collider.gameObject.tag=="urcharacter")
{
oncharacter=true;
}
else{
oncharacter=false;
}
private void OnGUI()
{
if(oncharacter==true)
{
// Make a background box,//x position ,y position width and wide
GUI.Box(new Rect(Screen.width / 2-75, Screen.height / 2-160, 200, 100), "");
//if the button is pressed means if exists
if(GUI.Button(new Rect (Screen.width / 2-75,Screen.height / 2-160,30,30),sand))
{
so hop u get the idea .please vote me if u get it work
↧