如果我們想給Unity內(nèi)置的類中添加新方法可以使用擴展的方式進行添加骆撇。具體看http://www.third-helix.com/2013/09/30/adding-to-unitys-builtin-classes-using-extension-methods.html锹漱。
like:
publicstaticclassGameObjectExtensions{publicstaticComponentGetComponent(thisGameObjectgameObject,Typetype){Debug.LogError(“LOL,yougottrolled”);}}