企业应该找什么样的网站建设公司,设计公司的企业远景,企业推广的成功在于他们发现,app网站建设需要什么Unity2013.1.19_DOTS_Burst compiler
DOTS是一种新产品#xff0c;现在尚在起步阶段。由于它处于持续发展中#xff0c;随着我们努力使其达到最佳状态#xff0c;您将看到API会不断演变和日趋成熟。
DOTS包含以下元素#xff1a; 实体组件系统(ECS) - 提供使用面向数据的…Unity2013.1.19_DOTS_Burst compiler
DOTS是一种新产品现在尚在起步阶段。由于它处于持续发展中随着我们努力使其达到最佳状态您将看到API会不断演变和日趋成熟。
DOTS包含以下元素 实体组件系统(ECS) - 提供使用面向数据的方法进行编码的框架。它通过Entities软件包进行分发您可以通过Package Manager来添加编辑器。 C#作业系统 - 提供一种生成多线程代码的简单方法。它通过Jobs软件包进行分发。 Burst编译器 - 可生成快速、优化的本机代码。它通过Burst软件包进行分发可通过Package Manager在编辑器中使用。 本机容器 - 属于ECS数据结构可提供对内存的控制。
继续跟进DOTS的第三个部分Burst compiler。官方是正道。
Unity - Manual: Burst (unity3d.com) Burst compiler简介
Burst设计Burst compiler是和JobSystem一起工作的。
在你的代码中使用Burst compiler先用 [BurstCompile]属性封装一个 Job struct 。
再添加[BurstCompile] 到你想要Burst编译的类型和静态方法中。
Burst compiles your code just-in-time (JIT) while in Play mode in the Editor, and ahead-of-time (AOT) when your application runs in a Player. For more information on compilation, see Burst compilation
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;public class MyBurst2Behavior : MonoBehaviour
{void Start(){var input new NativeArrayfloat(10, Allocator.Persistent);var output new NativeArrayfloat(1, Allocator.Persistent);for (int i 0; i input.Length; i)input[i] 1.0f * i;var job new MyJob{Input input,Output output};job.Schedule().Complete();Debug.Log(The result of the sum is: output[0]);input.Dispose();output.Dispose();}// Using BurstCompile to compile a Job with Burst[BurstCompile]private struct MyJob : IJob{[ReadOnly]public NativeArrayfloat Input;[WriteOnly]public NativeArrayfloat Output;public void Execute(){float result 0.0f;for (int i 0; i Input.Length; i){result Input[i];}Output[0] result;}}
}
参考文档
官方
About Burst | Burst | 1.8.12 (unity3d.com)
Unity 之Burst Compile底层原理 - 知乎 (zhihu.com)
Unity Live Help
什么是DOTS为什么说DOTS非常重要 - Unity Learn
Unity-Technologies/ECS-Network-Racing-Sample: ECS multiplayer racing sample to showcase using Unity Entities and netcode with best practices (github.com)
ECS系列教程
UnityECS_嵩小帽子啊的博客-CSDN博客[Unity ECS入门]8.System执行顺序-ECS入门-笨木头与游戏开发 (benmutou.com)