【Untiy3d-编辑器相关2】 Inspector上的一些编辑扩展


  1. [ContextMenu("Set SomeValue")]
  2. void SetSomeValue()
  3. {
  4.     Debug.Log("选中挂有此组件的GameObject的
  5.     Inspector面板右键,有Set SomeValue按钮显示");
  6. }

  1. [ContextMenuItem("Add Hp", "AddHp")]
  2. public int m_starValue = 100;
  3. void AddHp()
  4. {
  5.       m_starValue += 20;
  6.       Debug.Log("GameObject的Inspector面板右键
  7.       点击菜单AddHp里边的AddHp,改变值 = " + m_starValue);
  8. }

猜你喜欢

转载自blog.csdn.net/qq_19269527/article/details/84331226
今日推荐