一天一个小知识
会思考的猴子
这个作者很懒,什么都没留下…
展开
-
一天一个小知识 SpaceAttribute 和其他通用检查器
官网api解释 :https://docs.unity3d.com/ScriptReference/SpaceAttribute.html面板上添加间距原创 2021-02-23 09:24:29 · 150 阅读 · 0 评论 -
Unity 判断平台
1.判断程序运行平台Application.platform != RuntimePlatform.WindowsEditor // 关闭程序 CloseBtn.onClick.AddListener(() => { if (Application.platform != RuntimePlatform.WindowsEditor) { ...原创 2021-01-07 11:10:11 · 506 阅读 · 0 评论 -
Unity 保存多个文件,防止文件名冲突的建议
当你在一个文件夹下需要保存多个文件的时候,为了文件名不冲突可以使用 DateTime.Now.ToFileTime()这个函数 string sImageName = DateTime.Now.ToFileTime().ToString() + ".png";原创 2021-01-06 13:20:45 · 392 阅读 · 0 评论 -
Unity toggle组件设置选中状态和未选中状态颜色
Toggle toggle = self.GetComponent<Toggle>();//toggle.group = toggleGroup;toggle.onValueChanged.AddListener(isOn => { ColorBlock cb = toggle.colors; if (isOn) { cb.n...原创 2021-01-04 10:16:55 · 3724 阅读 · 1 评论 -
一天一个小知识 Unity [ExecuteInEditMode]
ExecuteInEditModeUnity中默认情况下,脚本只有在运行的时候才被执行,加上此属性后,不运行程序,也能执行脚本。例如 ,不运行unity,VideoPlayer组件也会播放视频using UnityEngine;using UnityEngine.Video;[ExecuteInEditMode][RequireComponent(typeof(VideoPlayer))]public class VideoPlayerPlayFromStreamingAss..原创 2020-10-21 09:26:48 · 341 阅读 · 0 评论