随笔分类 -  程序开发

摘要:原文链接 https://learn.microsoft.com/en-us/windows/win32/direct3d9/efficiently-drawing-multiple-instances-of-geometry?redirectedfrom=MSDN Given a scene th 阅读全文
posted @ 2024-02-18 14:01 dewxin 阅读(37) 评论(0) 推荐(0)
摘要:原文地址 https://thegamedev.guru/unity-performance/draw-call-optimization/#wait-whats-a-draw-call 目录什么是DrawCallBatches vs SetPassesCounting Unity Draw Cal 阅读全文
posted @ 2024-02-18 13:35 dewxin 阅读(197) 评论(0) 推荐(0)
摘要:简介 Unity是一个非常优秀的引擎,但其中有些设计在提供方便的同时也埋下了隐患,比如BroadcastMessage以及UnityEngine.Object中的隐式转换。 本文通过使用Harmony注入C#代码,达到检测隐式转换的效果,提供了替换Unity引擎C#代码的思路。 Harmony Ha 阅读全文
posted @ 2023-12-08 23:05 dewxin 阅读(494) 评论(0) 推荐(0)
摘要:https://gist.github.com/bikrone/666bb26fb0d4468df12c890ecc6c512e using UnityEditor; using UnityEngine; public sealed class ExampleClass : EditorWindow 阅读全文
posted @ 2023-12-01 22:39 dewxin 阅读(191) 评论(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 阅读(85) 评论(0) 推荐(0)
摘要:Unity在编辑器退出EditMode进入PlayMode之前,调用了一次Start和Update,然后提供了空的数据。 这个时候容易造成除以0的情况,但是Unity没有立刻抛出异常,而是继续执行,生成了一个无穷大的数值。 阅读全文
posted @ 2023-11-23 15:07 dewxin 阅读(1206) 评论(0) 推荐(0)
摘要:目录什么是MenuItemMenuItem类的构造函数MenuItem的快捷键向GameObject目录添加MenuItemMenuItem官方案例代码NGUI中的MenuItemNGUI中的GenericItem使用Context MenuItem 打开脚本的CustomEditor 什么是Men 阅读全文
posted @ 2023-11-22 00:09 dewxin 阅读(101) 评论(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 阅读(264) 评论(0) 推荐(0)
摘要:开发过程中遇到同一个mesh,同一个shader,但是出现渲染结果不一致的情况。 初步猜测是光栅化后,像素中心对应物体的位置不同,uv通过插值生成,从而导致渲染结果不一致。 下文验证了uv会随着物体的位置不同,而发生改变。 验证 使用了 https://github.com/cinight/Mini 阅读全文
posted @ 2023-10-31 16:35 dewxin 阅读(86) 评论(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 阅读(23) 评论(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 阅读(111) 评论(0) 推荐(0)
摘要:看这本书其实就行。Building Quality Shaders for Unity ShaderLab 首先我们创建一个URP工程,然后复制这个地址里的shader。 Unity中的shader以ShaderLab的格式编写。 下面是上面地址复制的ShaderObject // ShaderLa 阅读全文
posted @ 2023-10-25 19:20 dewxin 阅读(106) 评论(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 阅读(481) 评论(0) 推荐(0)
摘要:问题展示 这个图片中,可以发现 巴 郡 两个字的移动和其他图片不一致。 表面原因 是因为这个两个图片资产的filter mode 为point导致的,其他图片资产为bilinear。 解决方案 未知。 阅读全文
posted @ 2023-10-11 19:26 dewxin 阅读(32) 评论(0) 推荐(0)
摘要:背景 之前尝试在Unity编辑器用代码读取打包好的数据,发现在布置场景的时候不能做到所见即所得,这里将运行时读取到的图片素材,保存为spritesheet,并设置对应的sprite。 效果展示 代码 using System; using System.Collections.Generic; us 阅读全文
posted @ 2023-09-28 15:19 dewxin 阅读(366) 评论(0) 推荐(0)
摘要:最近调试的时候,发现游戏的鼠标会自己重置回游戏的中心位置。 找了半天发现是 ngui 的UICamera 里面会设置Cursor.lockState 。。 static public KeyCode currentKey { get { return mCurrentKey; } set { if 阅读全文
posted @ 2023-09-20 00:45 dewxin 阅读(135) 评论(0) 推荐(0)
摘要:背景介绍 做2D横版游戏的时候,通常会放置一个背景图片,但如果背景图片一动不动,大脑会将其和中心位置的角色捆绑,从而给玩家一种变扭的感觉,以及久了会导致眩目的不良体验。 因此希望背景图片也能像日常中的远景一样,能够随着人物的移动而移动。 目标效果 我们期望在地图左下角的时候,显示的是背景左下角的部分 阅读全文
posted @ 2023-09-18 00:25 dewxin 阅读(473) 评论(0) 推荐(0)
摘要:### 简介 想对单例进行统一的管理,在UnityEditor[进入playMode](https://docs.unity.cn/2019.4/Documentation/ScriptReference/EditorApplication-playModeStateChanged.html)的时候 阅读全文
posted @ 2023-09-05 15:03 dewxin 阅读(38) 评论(0) 推荐(0)
摘要:[toc] ### 简介 最近需要利用他人打包好的资源,接近8G,不是很大,但解压完小文件特别多,到了unity里面会频繁显示repaint提示窗,降低了开发效率。 于是采用了进游戏即时解包的策略,虽然资源可以在需要时再加载,但资源的索引需要在进入游戏时就构建好。构建资源id到文件偏移位置的映射,单 阅读全文
posted @ 2023-09-01 14:39 dewxin 阅读(362) 评论(0) 推荐(0)