使用步骤
(1)AssetStore搜索HighlightingSystem,将其导入Unity进行使用。
(2)给摄像机挂载脚本Highlighting Renderer组件,无需设置,直接挂载即可。
(3)创建立方体,设计脚本如下。
using HighlightingSystem;
public class HightTest : MonoBehaviour {
Highlighter h;
// Use this for initialization
void Start () {
h= this.gameObject.AddComponent<Highlighter> ();
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.A)) {
//h.ConstantOn (Color.red);
//h.ConstantOffImmediate ();
h.FlashingOn (Color.blue,Color.cyan,2f);
}
if (Input.GetKeyUp (KeyCode.A)) {
//h.ConstantOff ();
//h.ConstantOffImmediate ();
h.FlashingOff();
}
}
}
(4)测试,按住A键,观察立方体效果。