注意:
<p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; font-size: 14px; font-family: 微软雅黑, 宋体, 黑体, Arial; line-height: 28px; white-space: normal; background-color: rgb(255, 255, 255);">1、这个类必须声明为static,扩展的方法也必须要声明为static</p><p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; font-size: 14px; font-family: 微软雅黑, 宋体, 黑体, Arial; line-height: 28px; white-space: normal; background-color: rgb(255, 255, 255);">2、在使用时,就可以直接调用扩展的方法</p>
using UnityEngine; using System.Collections; //It is common to create a class to contain all of your //extension methods. This class must be static. public static class ExtensionMethods { //Even though they are used like normal methods, extension //methods must
对unity原有类进行扩展
最新推荐文章于 2024-03-29 22:16:10 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)