Unity工作日志【Tips】

【1】

Untiy3D中的路径使用的是 /
//把路径中的 \ 转换为 /
string path = path.Replace(@”\” , “/”);
ps:正确路径写法
1.Resources/Texture/sky
2.Resources\Texture\sky


【2】

减少使用enum,多使用class


【3】

减少foreach的使用,每一次迭代循环都是Enumerator对象的创建和销毁,增加GC


【4】

Transform transform;
transform.rotation = Quaternion.Euler(new Vector3(x,y,z));


【5】

设置vs的4格对齐:工具 - 选项 - 所有语言 - 制表符这里写图片描述

设置代码块自动对齐:ctrl + k , ctrl + f

猜你喜欢

转载自blog.csdn.net/itsxwz/article/details/79983653
今日推荐