导入Asset时自动标记Addressable
Posted on
CS文件编码批量转换为UTF-8 / 以UTF-8保存
Posted on
问题
突然发现项目里CS文件的编码是GBK,文件里的中文字符在Inspector上也显示为乱码。
于是用C#写一个工具,编译后丢到Assets目录里,批量转换。
1 | using System.Text; |
然而从Unity创建CS文件,文件的编码格式仍然是GBK。那么就要修改设置,以UTF-8的编码保存。
在Unity中使用Init关键字
Posted on
在Unity中使用System.Text.Json
Posted on
在Plugins文件夹导入以下dll:
- Microsoft.Bcl.AsyncInterfaces
- System.Buffers
- System.Memory
- System.Numerics.Vectors
- System.Runtime.CompilerServices.Unsafe
- System.Text.Encodings.Web
- System.Text.Json
- System.Threading.Tasks.Extensions
升级到Unity6后TexhMeshPro文字变成白块
Posted on
Drags can only be started from MouseDown or MouseDrag events
Posted on
问题
为编辑器创建鼠标拖拽事件时,如果判定方式是点击鼠标左键:
private void OnMouseDown(MouseDownEvent evt)
{
if (evt.button == (int)MouseButton.LeftMouse)
{
DragAndDrop.PrepareStartDrag();
DragAndDrop.SetGenericData("BlackboardField", this);
DragAndDrop.StartDrag("Dragging Blackboard Field.");
evt.StopPropagation();
}
}
会出现报错:
Drags can only be started from MouseDown or MouseDrag events.