碧血红天的HomePage

U3D杂谈 — 认识MenuItem属性

在U3d中,如果我们想添加菜单项,就会使用到MenuItem属性。几乎可以创建编辑器中大部分菜单项了。比如编辑器窗口菜单栏上的菜单,Hierarchy的右键菜单,Project窗口上的右键菜单等。

这个属性只能标记static方法,注意点需要注意。

菜单栏菜单项

[MenuItem("RG_SLG/LuaCmder")]
public static void Func1()
{

}

Hierarchy右键菜单

[MenuItem("GameObject/Copy Path",false 10)]
public static void Func1()
{

}

Project右键菜单

[MenuItem("Assets/TestMenu")]
public static void Func2()
{

}

Inspector右键菜单

[MenuItem("CONTEXT/Component/TestMenu2")]
public static void Func3(MenuCommand command)
{

}

属性中的Component代表是组件对象的菜单,其它就不会显示。

菜单快捷键

我们添加的菜单也能设置快捷键,如果我们要给一个菜单项添加快捷键,在菜单项名字后面添加空格然后下划线然后接按钮名字,比如:

[MenuItem("GameObject/Copy Path _g",false 10)]

如果需要组合键,比如ctrl,shift,和alt。这些有专门的符号,%(ctrl),#(shift),&(alt)。写法可以如下:

[MenuItem("GameObject/Copy Path #&g",false 10)] //ctrl+alt+g

59 评论

  1. I love your blog.. very nice colors & theme. Did you create this website yourself? Plz reply back as I’m looking to create my own blog and would like to know wheere u got this from. thanks

  2. hi opp ggeis 2022 ert go fi

  3. I have not checked in here for a while because I thought it was getting boring, but the last several posts are good quality so I guess I?¦ll add you back to my everyday bloglist. You deserve it my friend 🙂

  4. Hello There. I discovered your weblog the usage of msn. This is a very well written article. I’ll make sure to bookmark it and come back to read extra of your useful information. Thanks for the post. I’ll certainly comeback.

  5. Rattling informative and good structure of written content, now that’s user pleasant (:.

  6. Way cool, some valid points! I appreciate you making this article available, the rest of the site is also high quality. Have a fun.

  7. I would like to thnkx for the efforts you have put in writing this blog. I am hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing abilities has inspired me to get my own blog now. Really the blogging is spreading its wings quickly. Your write up is a good example of it.

  8. That is the precise weblog for anyone who wants to find out about this topic. You notice a lot its virtually arduous to argue with you (not that I really would need…HaHa). You undoubtedly put a brand new spin on a topic thats been written about for years. Nice stuff, just great!

  9. There’s noticeably a bundle to learn about this. I assume you made sure nice points in options also.

  10. Some really nice and utilitarian info on this website, likewise I think the design and style has wonderful features.

  11. A lot of thanks for all your hard work on this site. Betty delights in engaging in investigation and it is easy to see why. My spouse and i notice all concerning the compelling means you render precious guidelines through your web site and therefore recommend response from website visitors on the idea then my simple princess is actually discovering a lot. Take advantage of the rest of the new year. You have been doing a really great job.

  12. Exceptional post however , I was wondering if you could write a litte more on this subject? I’d be very grateful if you could elaborate a little bit more. Bless you!

  13. Great wordpress blog here.. It’s hard to find quality writing like yours these days. I really appreciate people like you! take care

  14. I really enjoy studying on this web site, it holds fantastic posts. “Dream no small dreams. They have no power to stir the souls of men.” by Victor Hugo.

  15. Undeniably believe that which you said. Your favorite reason appeared to be on the net the easiest thing to be aware of. I say to you, I certainly get annoyed while people think about worries that they just do not know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side effect , people could take a signal. Will probably be back to get more. Thanks

  16. I am really impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you modify it yourself? Either way keep up the excellent quality writing, it’s rare to see a great blog like this one today..

  17. hi!,I really like your writing so much! percentage we be in contact more about your post on AOL? I need a specialist in this space to resolve my problem. May be that’s you! Taking a look forward to look you.

  18. Its great as your other posts : D, thankyou for putting up. “To be at peace with ourselves we need to know ourselves.” by Caitlin Matthews.

  19. Hello, you used to write great, but the last few posts have been kinda boring?K I miss your super writings. Past several posts are just a bit out of track! come on!

  20. Dead composed content material, regards for information. “The earth was made round so we would not see too far down the road.” by Karen Blixen.

  21. This design is wicked! You most certainly know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Great job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  22. Its fantastic as your other content : D, thankyou for posting. “Experience is that marvelous thing that enables you to recognize a mistake when you make it again.” by Franklin P. Jones.

  23. Wow, awesome weblog structure! How lengthy have you ever been running a blog for? you make blogging glance easy. The whole look of your website is excellent, let alone the content material!

  24. I discovered your weblog website on google and examine just a few of your early posts. Proceed to maintain up the very good operate. I just extra up your RSS feed to my MSN Information Reader. Looking for ahead to reading extra from you later on!…

  25. Oh my goodness!! !!! “밤부” Incredible article dude! but can’t post my nudes here 🙁

  26. I know this if off topic but I’m looking into starting my own blog and was curious what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very web smart so I’m not 100 sure. Any recommendations or advice would be greatly appreciated. Appreciate it

  27. canadian cialis cialis sex pill buy voucher for cialis daily online

  28. best viagra uk buy viagra online rx cheapest generic viagra prices online

  29. cialis meaning cialis used for tadalafil brand name

  30. buy cialis no prescription cialis effectiveness cialis medicare

  31. cialis australia online cialis 20 mg tablets buy cialis on liuner

  32. viagra in canada cost where can i get viagra in canada how to buy viagra in india

  33. female viagra pill canada viagra for women over the counter buy brand viagra 100mg

  34. pharmacy logo rx cvs pharmacy domperidone simvastatin canada pharmacy

  35. canadian pharmacy online accutane walmart pharmacy online refill buy cialis bangkok pharmacy

  36. uk online pharmacy tramadol can you buy viagra pharmacy asda pharmacy ventolin

  37. online pharmacy checker synthroid pharmacy price clopidogrel online pharmacy

  38. canadian pharmacy for viagra cheapest pharmacy viagra rx good neighbor pharmacy

  39. 805551 sildenafil cialis generic viagra viagra 100mg tablet price in india online

  40. cialis dapoxetine cialis super active vs regular cialis cialis 20 mg how long does it take to work

  41. discount tadalafil 20mg can you buy cialis online purchase cialis on line

  42. best viagra uk order viagra for women generic viagra from canada online

  43. generic viagra 25 order viagra with paypal canadian medicine viagra

  44. viagra generic 100mg sildenafil coupon sildenafil 25 mg tablet

  45. sildenafil 10 mg india order viagra india sildenafil 25 mg daily

  46. how often can i take cialis cialis from mexico how often can you take cialis 20 mg

  47. cialis 36 hour online where to buy cialis in canada buy tadalafil without prescription

  48. cialis for women side effects cialis buy india rasa research tadalafil reviews

  49. free samples of cialis tadalafil natural source buy liquid tadalafil

  50. cialis vs viagra side effects soft gel cialis tadalafil ebay

  51. viagra 100 mg tablet buy online generic viagra pharmacy sildenafil tablets 100mg buy

  52. buy generic viagra usa female viagra pills online viagra over the counter mexico

  53. what is better viagra or cialis definition cialis buying cialis without prescription

发表评论