画一个圆圈在被锁物体上:新建一个UI
修改cameraconctoller,
using UnityEngine.UI;//取得ui类别
public bool lockState;//查看是否锁死
lockState = false;//在引擎里面显示是否被锁死
if (cols.Length == 0)//长度为0那么就是没锁过东西
{
lockTarget = null;
lockDot.enabled = false;//圆圈不显示
lockState = false;
}
else//否则锁过
{
foreach (var col in cols)
{
// print(col.name);
if (lockTarget == col.gameObject)
{
lockTarget = null;
lockDot.enabled = false;
lockState = false;
break;
}
lockTarget = col.gameObject;//将被锁定的东西赋值给locktarget
lockDot.enabled = true;//显示圆圈
lockState = true;
break;
}
}
//else
//{
// //relese lock
// lockTarget = null;//如果里面有被锁物件那么就清空他
//}
}
}