上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 42 下一页
摘要: 1.if else 不要超过3个分支 2.switch case 禁用 3.枚举,慎用,如果增加枚举其他地方不修改可使用,否则不能使用 4.if括号内的条件判断,不要超过2个 为什么不要超过2个,超过2个就是3个,5个,10个,上次还见到过一个20个的 这种优化,使用委托即可完成优化,类该拆分的拆分 阅读全文
posted @ 2021-06-06 19:14 三页菌 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 抄的Unity的源码 HandleUtility.DistancePointLine 是UnityEditor代码,源码如下,这样就可以在Runtime中运行 注意性能开销! /// <summary> /// 计算点到线段的最短距离 /// </summary> /// <param name=" 阅读全文
posted @ 2021-06-04 17:00 三页菌 阅读(751) 评论(0) 推荐(0) 编辑
摘要: bool ContainsPoint(List<Vector2> polyPoints, Vector2 p) { var j = polyPoints.Count - 1; var inside = false; for (int i = 0; i < polyPoints.Count; j = 阅读全文
posted @ 2021-06-04 12:07 三页菌 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 写在Update里面 var newPos = transform.position; if (lastPos != newPos) { targetRotation = Quaternion.LookRotation(newPos - lastPos); } if (Math.Abs(transf 阅读全文
posted @ 2021-06-03 19:42 三页菌 阅读(111) 评论(0) 推荐(0) 编辑
摘要: nity3D有一个叫做”live recompile”的功能,即在编辑器处于播放状态时修改脚本代码或替换托管dll等操作时,当场触发重新编译生成项目脚本assembly,并会进行重新加载操作,然而,这个功能很多时候并不能保证重加载后的代码逻辑依然能正常运行,轻则报错,重则卡死。经过博主测试发现,Un 阅读全文
posted @ 2021-06-03 15:37 三页菌 阅读(4666) 评论(0) 推荐(0) 编辑
摘要: 原因:在初始化配置Git用户信息时,设置了用户密码 解决方式:重置用户密码,并设置为空 $ ssh-keygen -p Enter file in which the key is (/c/Users/xxx/.ssh/id_rsa): (直接Enter)Enter old passphrase:( 阅读全文
posted @ 2021-06-03 15:25 三页菌 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 客户端 using System; using System.Collections; using System.Collections.Generic; using System.Net; using System.Text; using System.Threading; using Newto 阅读全文
posted @ 2021-05-31 00:53 三页菌 阅读(929) 评论(0) 推荐(0) 编辑
摘要: https://github.com/Cysharp/UniTask 阅读全文
posted @ 2021-05-21 09:10 三页菌 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 打开设置,选择编程语言 At end of line (K&R style) 是侧括号换行,其他可自行尝试 else 相关 阅读全文
posted @ 2021-05-12 15:58 三页菌 阅读(2081) 评论(0) 推荐(0) 编辑
摘要: UGUI的开关方案一种是使用SetActive进行的 但是这种方案其实有一个弊端,我们来测试下 每帧进行1000次的SetActive 的true和false 这是我们的UI,上面挂了一些 按钮 图片 输入 等元素 帧率只有2.4,我们看下Profiler 可以看到 GameObject.Activ 阅读全文
posted @ 2021-05-08 14:35 三页菌 阅读(1261) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 42 下一页