随笔分类 -  Unity

摘要:目录简介IMGUIGUIClipPush Pop Count局部坐标StyleDraw中Rect点的位置鼠标位置绝对坐标ScrollOffset对局部坐标的影响局部坐标和绝对坐标的相互转化裁剪实战训练参考链接 简介 Unity中的IMGUI是一个独立于ugui的UI系统。IMGUI是事件(消息)驱动 阅读全文
posted @ 2025-01-22 22:04 dewxin 阅读(38) 评论(0) 推荐(0) 编辑
摘要:简介 在Unity Editor开发过程中,我们会经常使用反射调用一些unity还没开放的接口,比如s_LastControlID, 但每个程序集都写一边反射不免显得有些麻烦。 本篇文章将介绍注入InternalsVisibleToAttribute注解到unity dll的方法,来帮助大家更便捷地 阅读全文
posted @ 2025-01-19 16:01 dewxin 阅读(13) 评论(0) 推荐(0) 编辑
摘要:简介 在nodecanvas造轮子的过程,遇到了鼠标拖拽太快,节点经常会脱离控制的情况。但是nodecanvas却不会有这个问题。 一番折腾发现是nodecanvas调用了GUI.DragWindow(),而我觉得这个函数没啥用给删除了的原因。。 GUI.DragWindow()在MouseDown 阅读全文
posted @ 2025-01-14 22:06 dewxin 阅读(10) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/sailJs/p/18207923 public static void BeginClip(Rect position, Vector2 scrollOffset, Vector2 renderOffset, bool resetOffset) { 阅读全文
posted @ 2025-01-06 14:43 dewxin 阅读(10) 评论(0) 推荐(0) 编辑
摘要:可以使用 SerializedProperty.NextVisible 函数 这里会返回 序列化的,并且在Inspector中可见的属性。 注意参数表示是否切换成子对象的属性。 第一步操作必须是true。 接着这个参数不一定强制实现, 如果一直是false,在访问完本层对象的property后,即使 阅读全文
posted @ 2024-11-13 21:51 dewxin 阅读(22) 评论(0) 推荐(0) 编辑
摘要:本文参考了 https://www.cnblogs.com/Jean90/p/16193938.html 简介 PlayerLoop是Unity提供用于修改游戏循环中系统组成的接口。我们可以分别通过PlayerLoop.GetCurrentPlayerLoop和PlayerLoop.SetPlaye 阅读全文
posted @ 2024-06-24 21:27 dewxin 阅读(138) 评论(0) 推荐(0) 编辑
摘要:背景 使用Unity编辑器时,我们有时候会将服务端的一些信息通过Unity编辑,但由于这部分内容属于服务端,客户端仅限于编辑器中的编辑,我们并不希望将这部分内容打包出去。因此我们需要在打包时将其隐藏或者删除,但是又不影响编辑器的编辑。 打包相关的回调接口 IPreprocessBuildWithRe 阅读全文
posted @ 2024-06-10 20:17 dewxin 阅读(125) 评论(1) 推荐(0) 编辑
摘要:最终效果 步骤 进入梦幻西游所在文件夹,打开font目录,拷贝华康圆体hkyt.ttf到Unity工程目录。 打开FontMaker,生成对应字体asset。此时的效果如下 可以看到,效果还不错,但是看着有点累。用腾讯QQ的截图软件可以对比细节。可以发现网易的字体普遍有明亮的结构。所以肯定调高了亮度 阅读全文
posted @ 2024-05-05 16:28 dewxin 阅读(36) 评论(0) 推荐(0) 编辑
摘要:需求描述 我们需要实现一个类似英雄联盟中的技能CD遮罩,施放技能后,技能遮罩占满技能图标,随着时间推移,技能遮罩顺时针减少遮挡面积,CD结束时,遮罩应完全消失。 需求分析 由于每个时刻,都会有一条线从中心点射向上面那条边的中点,我们自然可以想到将遮罩面片分为8个三角形。 并且我们只需要按照给定的角度 阅读全文
posted @ 2024-02-22 22:46 dewxin 阅读(58) 评论(0) 推荐(0) 编辑
摘要:简介 Unity是一个非常优秀的引擎,但其中有些设计在提供方便的同时也埋下了隐患,比如BroadcastMessage以及UnityEngine.Object中的隐式转换。 本文通过使用Harmony注入C#代码,达到检测隐式转换的效果,提供了替换Unity引擎C#代码的思路。 Harmony Ha 阅读全文
posted @ 2023-12-08 23:05 dewxin 阅读(233) 评论(0) 推荐(0) 编辑
摘要:https://gist.github.com/bikrone/666bb26fb0d4468df12c890ecc6c512e using UnityEditor; using UnityEngine; public sealed class ExampleClass : EditorWindow 阅读全文
posted @ 2023-12-01 22:39 dewxin 阅读(125) 评论(0) 推荐(0) 编辑
摘要:文章转载自IMGUI crash course Unity's IMGUI system is quite simple but very powerful. The main parts are: The OnGUI callback. This callback is used to handl 阅读全文
posted @ 2023-11-24 13:20 dewxin 阅读(60) 评论(0) 推荐(0) 编辑
摘要:Unity在编辑器退出EditMode进入PlayMode之前,调用了一次Start和Update,然后提供了空的数据。 这个时候容易造成除以0的情况,但是Unity没有立刻抛出异常,而是继续执行,生成了一个无穷大的数值。 阅读全文
posted @ 2023-11-23 15:07 dewxin 阅读(876) 评论(0) 推荐(0) 编辑
摘要:目录什么是MenuItemMenuItem类的构造函数MenuItem的快捷键向GameObject目录添加MenuItemMenuItem官方案例代码NGUI中的MenuItemNGUI中的GenericItem使用Context MenuItem 打开脚本的CustomEditor 什么是Men 阅读全文
posted @ 2023-11-22 00:09 dewxin 阅读(52) 评论(0) 推荐(0) 编辑
摘要:Before you make any changes, you must profile your application to identify the cause of the problem. If you attempt to solve a performance problem bef 阅读全文
posted @ 2023-11-03 21:18 dewxin 阅读(145) 评论(0) 推荐(0) 编辑
摘要:开发过程中遇到同一个mesh,同一个shader,但是出现渲染结果不一致的情况。 初步猜测是光栅化后,像素中心对应物体的位置不同,uv通过插值生成,从而导致渲染结果不一致。 下文验证了uv会随着物体的位置不同,而发生改变。 验证 使用了 https://github.com/cinight/Mini 阅读全文
posted @ 2023-10-31 16:35 dewxin 阅读(43) 评论(0) 推荐(0) 编辑
摘要:可以看官方的 https://docs.unity3d.com/Manual/srp-custom-getting-started.html 或者 这位大佬的 https://zhuanlan.zhihu.com/p/378828898 阅读全文
posted @ 2023-10-30 22:12 dewxin 阅读(13) 评论(0) 推荐(0) 编辑
摘要:下图显示了该面片占用的像素个数为147456。 因为面片的大小为1,坐标为(0,0.5f,0)。相机为正交视角,OrthoSize为1. 面片完全显示且高度为 (768/2)^2 = 384^2 = 147456。 另外,可以推测,pixel shader渲染会在所有对象的vertex shader 阅读全文
posted @ 2023-10-29 22:13 dewxin 阅读(56) 评论(0) 推荐(0) 编辑
摘要:看这本书其实就行。Building Quality Shaders for Unity ShaderLab 首先我们创建一个URP工程,然后复制这个地址里的shader。 Unity中的shader以ShaderLab的格式编写。 下面是上面地址复制的ShaderObject // ShaderLa 阅读全文
posted @ 2023-10-25 19:20 dewxin 阅读(50) 评论(0) 推荐(0) 编辑
摘要:https://gamedevelopertips.com/unity-pixel-perfect-sprite/ So I was making a little prototype for my new game when I just came across a little problem. 阅读全文
posted @ 2023-10-11 19:37 dewxin 阅读(304) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示