- [ContextMenu("Set SomeValue")]
- void SetSomeValue()
- {
- Debug.Log("选中挂有此组件的GameObject的
- Inspector面板右键,有Set SomeValue按钮显示");
- }
- [ContextMenuItem("Add Hp", "AddHp")]
- public int m_starValue = 100;
- void AddHp()
- {
- m_starValue += 20;
- Debug.Log("GameObject的Inspector面板右键
- 点击菜单AddHp里边的AddHp,改变值 = " + m_starValue);
- }