选自过去1~2周的内容: https://twitter.com/unity3d
“UGUIEffect”可以用uGUI实现在波浪上反射的阴影
https://github.com/AsehesL/UGUIEffect
Unity 2019.1.0a10新功能现在可以通过单击Console的调用堆栈跳转到源代码的函数调用行
从Unity 2019.1.0a10开始
,现在可以通过单击控制台调用堆栈跳转到源代码的函数调用行
Unity 2019.1.0a10新功能现在可以通过hierarchy更改是否在“场景”视图中显示对象
现在,hierarchy允许您更改是否在Unity 2019.1.0a10的“场景”视图中显示对象
4)、 如何在Visual Studio中更改Unity事件的函数名称的显示颜色
通过选择“环境>字体和颜色”,更改“Unity消息”的“前景色”并按“确定”
5)、Unity 2019.1.0a 8新功能增量垃圾回收功能可避免GC峰值现已推出
https://blogs.unity3d.com/cn/2018/11/26/feature-preview-incremental-garbage-collection/
您可以 使用增量垃圾回收,通过在Unity菜单中的“Editor>Project Setting...”的“Player”选项卡中
启用“使用增量GC(实验)” 来避免GC峰值
6)、扩大UGUI 按钮的点击触发范围
让添加了“UICollider”组件,作为Button对象的子对象。
https://github.com/eral/UnityUIExtention
7)、 Camera的CulliingMask设置
仅指定x层
camera.cullingMask = 1 << x;
添加x图层
camera.cullingMask | =(1 << x);
除x层外
camera.cullingMask&=〜(1 << x);
启用除x层以外的所有内容
camera.cullingMask =〜(1 << x);
启用所有图层
camera.cullingMask = -1;
x层?
多重指定
camera.cullingMask = 1 << x + 1 << y + 1 << z;
8)、 在场景运行时 编辑脚本时,可以修改Unity的行为。 您可以重新编译并继续Play,等到停止重新编译 或 在代码更改时停止Play。(编辑>首选项>常规)
9)、 使用 Package Manager确实蛮好的, 但是确定就是所有扩展都是单独的DLL , 查看源代码变得比较不方便。
有一种方式可以解决:
将 C:\Users\XXXXXXX\AppData\Local\Unity\cache\packages\packages.unity.com 下的包文件夹 拷贝到 项目的 下:
重启VS 就可以看到源代码了
10)、 按顺序执行多个 C# Job
11)、 Job 输出 Log
using UnityEngine;
using Unity.Jobs;
using Unity.Entities;
using UnityEngine.Jobs;
public class LogJob : JobComponentSystem
{
private ComponentGroup _group;
protected override void OnCreateManager()
{
_group = GetComponentGroup(ComponentType.ReadOnly<Transform>());
}
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
inputDeps = new Log().Schedule( _group.GetTransformAccessArray(), inputDeps);
return inputDeps;
}
struct Log : IJobParallelForTransform
{
public void Execute(int index, TransformAccess transform)
{
Debug.Log(transform.position);
}
}
}
12)、 https://blogs.unity3d.com/cn/2018/12/05/project-tiny-preview-package-is-here/ (有系列视频 !)
Project Tiny是一种新的模块化Unity运行时和编辑器模式,旨在构建可以即时加载而无需安装的游戏和体验。截至今天,它可以通过软件包管理器作为Unity 2018.3的预览包,称为Tiny Mode。
Project Tiny为开发人员提供了快速创建高质量2D即时游戏和可播放广告所需的工具,这些游戏体积小,并且可以在各种移动设备上快速启动。
Project Tiny使用模块化架构构建,允许您选择要包含的功能。它采用纯数据导向的ECS方法,可以在较小的代码大小下实现高性能。目前的功能集专注于构建即时2D游戏和可播放广告。在未来的版本中,将添加其他功能以构建即时3D和AR游戏和体验。
虽然Project Tiny目前使用Typescript编写游戏逻辑,但在预览期间它将被C#替换。
重要的是要注意,一旦对C#的支持准备就绪,我们将删除Typescript 。
https://unity.com/cn/solutions/instant-games/2d-games-and-playables
https://forum.unity.com/threads/is-there-somewhere-to-get-the-tiny-package.593866/
https://forum.unity.com/forums/project-tiny.151/
14)、嘿Lvl设计师! 想拥有像这尊雕像一样的镜像......
只需将scale 更改为-1即可
15)、 如果要向颜色属性添加emission(不将光照到光照贴图上),请在着色器的属性块中的声明之前添加[HDR]标记!
https://twitter.com/HarryAlisavakis/status/1069917802918805504
Unity 2019 多出来的菜单: Clear All PlayerPrefs
16)、 编辑器扩展,在打开Unity项目时同时打开Visual Studio解决方案
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.Events;
[InitializeOnLoad]
public static class EditorApplicationUtility
{
private const BindingFlags BINDING_ATTR = BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic;
private static readonly FieldInfo m_info = typeof( EditorApplication ).GetField( "projectWasLoaded", BINDING_ATTR );
public static UnityAction projectWasLoaded
{
get
{
return m_info.GetValue( null ) as UnityAction;
}
set
{
var functions = m_info.GetValue( null ) as UnityAction;
functions += value;
m_info.SetValue( null, functions );
}
}
}
public static class Example
{
[InitializeOnLoadMethod]
private static void Hoge()
{
EditorApplicationUtility.projectWasLoaded += () =>
{
EditorApplication.ExecuteMenuItem( "Assets/Open C# Project" );
};
}
}
17)、 最佳协程练习 , 防止GC , 提前new 共用
18)、您可以使用 [Enum()] 语法在着色器中显示混合模式,剔除,模板和其他 per-pass 设置。