上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 41 下一页
摘要: 1) Rect rect; a) Sprite Mode为Single时: x, y总是为0; width, height为裁掉空白像素前的大小 b) Sprite Mode为Multiple时: 则x, y为slice区域在Sprite上的位置, 大小为slice区域的大小 2) Vector2 阅读全文
posted @ 2022-11-22 00:38 yanghui01 阅读(611) 评论(0) 推荐(0) 编辑
摘要: 开启Sprite Pack 图集打包 Packing Tag设置成相同名字的图片就会被打包进同一个图集a) 图集common_ui b) 图集icon 查看图集 菜单 -> Window -> 2D -> Sprite Packer 获取图集中的Sprite Sprite Pack打包的图集,Uni 阅读全文
posted @ 2022-11-21 00:52 yanghui01 阅读(972) 评论(0) 推荐(0) 编辑
摘要: 代码 #if UNITY_EDITOR using System.Collections.Generic; using System.IO; using System.Text; using UnityEditor; using UnityEngine; public class CmdTool { 阅读全文
posted @ 2022-11-20 13:33 yanghui01 阅读(697) 评论(0) 推荐(0) 编辑
摘要: 1) 获取AnimationClip public static bool TryGetAnimatorClip(Animator animator, string clipName, out AnimationClip outClip) { var clips = animator.runtime 阅读全文
posted @ 2022-11-19 22:48 yanghui01 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 原理 1) 异或运算法则:异或的两个bit相同结果为1,不同结果为02) 一个数^0还是自身, 没有任何效果,因为0^0=0, 1^0=1。例子:0b0101,1010 ^ 0b0000,0000=0b0101,10103) 单个bit^1是取反的效果,0^1=1, 1^1=0,所以一个int变量^ 阅读全文
posted @ 2022-11-19 22:31 yanghui01 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 先上结论 1) 右移:左侧会使用符号位补齐,比如:对于负数,右移时左侧补1;对于正数,右移时左侧补0;2) 左移:符号位也会被左移,右侧补03) 取反:符号位也会被取反 测试代码 //有符号数 static void Print(int a) { Console.WriteLine($"{Conve 阅读全文
posted @ 2022-11-19 22:10 yanghui01 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 正数和负数的补码区别 1) 对于正数,原码和补码相同 2) 对于负数,先得到反码,再计算补码反码:除符号位外取反补码:反码+1 补码示例 1) 35原码:0010,0011补码:0010,0011 2) 18原码:0001,0010补码:0001,0010 3) -18原码:1001,0010反码: 阅读全文
posted @ 2022-11-19 22:02 yanghui01 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 方式1:使用多个overrideController文件的方式 1) 创建一个通用的状态机,以及状态动画占位文件 2) 分别为不同的角色创建状态动画文件,并用overrideController进行绑定 a) Role1Override.overrideController,这边用正方形表示Role 阅读全文
posted @ 2022-11-09 01:05 yanghui01 阅读(1190) 评论(0) 推荐(0) 编辑
摘要: 界面需要做国际化的时候,一般不会在Text组件上使用中文,而是使用id或者key来代替,这个代码用于检测直接写了中文的Text #if UNITY_EDITOR using System.Text; using System.Text.RegularExpressions; using UnityE 阅读全文
posted @ 2022-11-08 23:07 yanghui01 阅读(53) 评论(0) 推荐(0) 编辑
摘要: RenderTexture或Texture2D -> RenderTexture public static RenderTexture TextureRenderToRT(Texture srcTex) { var srcTempRT = RenderTexture.GetTemporary(sr 阅读全文
posted @ 2022-11-08 00:36 yanghui01 阅读(433) 评论(0) 推荐(0) 编辑
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 41 下一页