Unity2018新功能整理归纳(收集吸收)

阅前提示

适合人群:ALL
阅读方式:浏览
文章主旨在于归纳整理Unity2018新功能,便于宏观了解和定点深入。

Unity2018

Unity2018更新日志大总结


Scriptable Render Pipeline

可编程渲染管道

整理如下,待学习:

Unity Surface Shaders and rendering paths

可编程渲染管线——LWRP轻量级渲染管线剖析

SRP-Demo

Scriptable Render Pipeline Overview


Shader Graph

安装:

Package Manager => Shader Graph & Render-Pipelines. Lightweight

Create => Rendering => LightweightRenderPipelineAsset

Edit => Project Settings => Graphics => Pipeline Settings

Edit => Render Pipeline => Upgrade

Create => Shader => xxx Graph

使用


Entity Component System

实体+组件+系统

实体:游戏组成的基本单元 , 用来挂载组件
组件:单纯的数据,仅仅代表该组件的特性
系统:用来处理拥有组件的实体集合,单纯的行为。

改变开发模式,面向数据设计,解决 GameObject/MonoBehaviour 处理容量大的瓶颈

适合与Job System 实现 SIMD

/*两种组件方式*/
///混合
public class SimpleHybirdComponent : MonoBehaviour{public int a;}
///纯ECS
public struct SimpleValue : IComponentData{public int a;}
public class SimpleComponent:ComponentDataProxy<SimpleValue>{} // 解决挂载问题
/// 两者都是挂于实体之上,需要有 GameObjectEntity 存在

/*System*/
public class SimpleSystem : ComponentSystem
{
    struct Group
    {
        public SimpleHybirdComponent  simpleComponent;
        public Transform transform;
    }

    struct InjectGroup
    {
        public readonly int Length;
        public ComponentArray<SimpleHybirdComponent> components;
    }

    [Inject] InjectGroup injectG; //注入属性,启动时会被赋值
    protected override void OnUpdate()
    {
        //GetEntities<T> 将会遍历所有实体获取符合组件组的实体
        Debug.Log(injectG.Length);
        Debug.Log(injectG.components.Length);
        foreach (var item in GetEntities<Group>())
        {
            item.transform.Rotate(Vector3.up * item.simpleComponent.a * Time.deltaTime);
        }
    }
}

/*System*/
public class JobSimpleSystem : JobComponentSystem
{
        /// <summary>
        /// 使用IJobProcessComponentData遍历符合条件的所有Entity。
        /// 此过程是单进程的并行计算(SIMD)
        /// IJobProcessComponentData 是遍历entity的简便方法,并且也比IJobParallelFor更高效
        /// </summary>
        struct D : IJobProcessComponentData<SimpleValue>
        {
            /// <summary>
            /// 实现接口,在Excute中实现旋转
            /// </summary>
            public void Execute(ref SimpleValue v)
            {
                Debug.Log("JobComponentSystem:"+v.a);
            }
        }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new D();
        return job.Schedule(this);
    }     
}

ECS+C#Jobs例子


C# Jobs System

帮助编写更简单更安全的多线程代码与Unity交互。

Jobs System 通过创建Job来进行多线程工作,替代线程。

官方文档

官方文档翻译

Unity C# Job System介绍


Burst

Burst是一个编译器,它使用LLVM将IL / .NET字节码转换为高度优化的本机代码

Burst主要用于与Job系统高效协作。
您可以通过使用属性[BurstCompile]装饰Job结构,从而在代码中简单地使用burst编译器 。

Burst User Guide

Unity Burst 用户指南 翻译


Improved Prefab Workflows

功能:

Prefab Mode中编辑预制体
Nested Prefabs (嵌套式预制体)
Prefab Overrides (预制件覆盖/重载)
Prefab Variants (预制件变体)
使用脚本API操作Prefab

Unity2018.3全新Prefab预制件系统深入介绍


  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值