Unity拓展
Dragon Peng
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【Unity】通用MonoBehaviour单例
【代码】【Unity】通用MonoBehaviour单例。原创 2023-02-09 15:25:20 · 359 阅读 · 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 · 391 阅读 · 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 · 779 阅读 · 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 · 531 阅读 · 0 评论
分享