Unity拓展
Dragon Peng
这个作者很懒,什么都没留下…
展开
-
【Unity】通用MonoBehaviour单例
【代码】【Unity】通用MonoBehaviour单例。原创 2023-02-09 15:25:20 · 239 阅读 · 0 评论 -
Unity拓展方法的定义与调用
拓展方法的定义 拓展方法必须定义在静态类中 拓展方法必须是静态的 拓展方法的修饰符this必须在第一个参数前方 示例: public static class Expand { public static T GetComponent<T>(this GameObject varGame,string varPath)where T : Component { if (string.IsNullOrEmpty(varPath)) return va原创 2021-09-30 14:14:32 · 295 阅读 · 0 评论 -
获取模型的实际大小
获取模型的实际大小模型的实际大小计算 模型的实际大小计算 在Unity中计算模型的实际大小需要确保模型的scale值为Vector3.one;否则在计算模型实际大小时会出现计算偏差 public Vector3 GetModelSize(Transform varTransform) { //记录模型的初始信息 Vector3 postion = varTransform.postion; Quaternion rotation = varTransform.rotation; Vector3 s原创 2020-11-10 11:38:24 · 675 阅读 · 0 评论 -
阿拉伯数值转换成中文数值
拓展方法之数值转换成中文数值对数值进行转化将数值进行拆分将数值转换成汉字Demo 对数值进行转化 public static string ToChinese(this byte index) { return GetChinese(index.ToString()); } public static string ToChinese(this ushort index) { return GetChinese(index.ToString()); } public static string ToC原创 2021-09-30 11:00:10 · 299 阅读 · 0 评论