摘要: 本文记录我在编程里学到的一些小技巧,遇到了就记录一下。 1.如果通用接口中的回调没有参数,而调用时需要参数,这个时候可以用匿名函数多封装一层。例如: 2.List使用lambda表达式升序或降序排序 1 private List<int> list = new List<int>(); 2 3 pr 阅读全文
posted @ 2018-04-02 14:05 大文豪 阅读(556) 评论(1) 推荐(0) 编辑
摘要: UnityEditor 复制文本到剪切板 GUIUtility.systemCopyBuffer 获取资源路径 AssetDatabase.GetAssetPath 选择节点 Selection.activeObject Editor启动程序 EditorApplication.EnterPlaym 阅读全文
posted @ 2019-08-05 11:32 大文豪 阅读(382) 评论(1) 推荐(0) 编辑
摘要: Shift+Alt+A 物体快速激活 Ctrl+P 开始 Ctrl+Shift+P 暂停 Ctrl+B 编译并运行 Z Pivot/Center切换 X Local/Global切换 阅读全文
posted @ 2019-02-22 11:01 大文豪 阅读(1152) 评论(0) 推荐(0) 编辑
摘要: 创建ScriptObject可以创建带序列化的资源,只保存数据不用绑定在游戏对象上。创建出来的本子资源可以通过资源加载到游戏里使用。这里介绍一下使用Resources加载。 创建好的asset文件也可以在Inspector中进行编辑。 这里写一个简单的数据。 其中[CreateAssetMenu]属 阅读全文
posted @ 2019-02-21 16:32 大文豪 阅读(10578) 评论(0) 推荐(1) 编辑
摘要: Untiy左上角有两个按钮 Pivot/Center 和 Local/Global 它们叫做 变换Gizmo工具 他们可以有以下组合方式 Pivot和Local是比较常用的一种组合方式 它们的作用为位置变换操作。主要对位移、旋转、缩放有所影响。 Pivot/Center是指选中一个GameObjec 阅读全文
posted @ 2019-02-20 14:55 大文豪 阅读(3755) 评论(1) 推荐(1) 编辑
摘要: 创建Button后,会出现一个Image组件和一个Button组件,以及Button子节点Text(可以删除不影响功能) 其中Image的Image Type中有四个选项--Simple、Sliced、Tiled、Filled (1) Simple即把图片放上去不做任何处理,Preserve Asp 阅读全文
posted @ 2018-11-09 11:27 大文豪 阅读(3648) 评论(1) 推荐(0) 编辑
摘要: Image组件在Inspector Source Image--需要一个Sprite(精灵)。 Color--图片的颜色 Material--可以添加材质球 RayCast Target--选中可以传递消息给EventSystem 阅读全文
posted @ 2018-11-08 11:43 大文豪 阅读(1233) 评论(0) 推荐(0) 编辑
摘要: 下图是Text组件的内容。 Character(字符) Text--输入要显示的文本 Font--要渲染文本的字体类型(例如:黑体、宋体) FontStyle--是否要加粗,倾斜等。 Normal--正常 Bold--加粗 Italic--倾斜 Bold and Italic--加粗并倾斜 Line 阅读全文
posted @ 2018-11-08 11:30 大文豪 阅读(6529) 评论(0) 推荐(0) 编辑
摘要: 1 using UnityEngine; 2 using UnityEditor; 3 using System.IO; 4 5 public class CreateAsset : EditorWindow 6 { 7 private string mConfigName = "TestAsset"; 8 private string mAssetPath =... 阅读全文
posted @ 2018-10-29 16:24 大文豪 阅读(2291) 评论(1) 推荐(0) 编辑
摘要: Unix时间戳(Unix timestamp),或称Unix时间(Unix time)、POSIX时间(POSIX time),是一种时间表示方式,定义为从格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数。Unix时间戳不仅被使 阅读全文
posted @ 2018-07-19 17:31 大文豪 阅读(7920) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using UnityEngine; 3 using UnityEditor; 4 using UnityEngine.Serialization; 5 using Random = UnityEngine.Random; 6 7 [DisallowMultipleComponent]// 禁止同时给一个物体添加多个NewBeh... 阅读全文
posted @ 2018-06-13 15:13 大文豪 阅读(1242) 评论(0) 推荐(0) 编辑

123