当前位置: 首页 > news >正文

漂亮的网站单页wordpress wp_user_query

漂亮的网站单页,wordpress wp_user_query,网站建设主要工作,企业网站seo外包 sSystemBase:支持主线程或多线程执行筛选实体任务。 主要介绍是内部成员:Entities的各种筛选方法,其内部成员还有EntityManager ForEach方法筛选,传递一个有参委托函数进去,参数ref xxx组件类(可填多个&…

SystemBase:支持主线程或多线程执行筛选实体任务。
主要介绍是内部成员:Entities的各种筛选方法,其内部成员还有EntityManager

ForEach方法筛选,传递一个有参委托函数进去,参数ref xxx组件类(可填多个)代表筛选条件。

WithAll:&& 形式筛选组件
WithAny: || 形式筛选组件
WithNone: 筛选出不带某组件的
WithChangeFilter:监听组件数据变化时触发筛选
WithSharedComponentFilter:筛选共享组件(指定特定数据)
WithStoreEntityQueryInField(ref EntityQuery对象):存储筛选结果
WithEntityQueryOptions(EntityQueryOptions):
        EntityQueryOptions.FilterWriteGroup:筛选带[WriteGroup(typeof(xxx))特性的组件
        EntityQueryOptions.IncludeDisabled:具有Disabled(已禁用)组件的实体
        EntityQueryOptions.IncludePrefab:具有Prefab组件的实体
WithoutBurst:不使用Burst编译
WithBurst:使用Burst编译

Run:主线程(单线程执行)
Schedule:多线程并发
ScheduleParallel:多线程并行

using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
/// <summary>
/// 可操作主线程或多线程; ComponentSystem单线程 JobComponentSystem多线程
/// </summary>
public class MySystemBase : SystemBase
{EntityQuery query;//以下方法从上到下按顺序执行protected override void OnCreate(){Debug.Log("OnCreate");}protected override void OnStartRunning(){Debug.Log("OnStartRunning");}protected override void OnUpdate(){Debug.Log("OnUpdate");//使用内部成员Entities遍历所有实体筛选出Translation组件的实体进行修改Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).Run();//使用WithAll增加筛选条件,必须带有PrintTestComponentData组件的//使用Run()代表是主线程执行Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithAll<PrintTestComponentData>().Run();//WithAny 只要带任意一个即可满足筛选Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithAny<PrintTestComponentData>().Run();//WithNone 不包含xxx的Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithNone<PrintTestComponentData>().Run();//WithChangeFilter 监听组件值变化时才触发方法体,参数必须带上ref PrintTestComponentData  否则会报错Entities.ForEach((ref Translation trans, ref PrintTestComponentData data) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithChangeFilter<PrintTestComponentData>().Run();//WithSharedComponentFilter 筛选共享组件 特定值为2的Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithSharedComponentFilter(new MyShareComponentData() { data = 2 }).Run();//存储筛选结果        Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithStoreEntityQueryInField(ref query).Run();NativeArray<Entity> array = query.ToEntityArray(Unity.Collections.Allocator.TempJob);foreach (var v in array){//do something}//过滤出带[WriteGroup]特性的组件实体  [WriteGroup(typeof(PrintTestComponentData))] 查询会根据查询中指定的组件的WriteGroupAttribute属性筛选所选实体Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithEntityQueryOptions(EntityQueryOptions.FilterWriteGroup).Run();//过滤出带[DisableAutoCreation]特性的组件实体  该查询不会隐式的排除具有Disabled(已禁用)组件的实体Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithEntityQueryOptions(EntityQueryOptions.IncludeDisabled).Run();//过滤出预制体实体  [DisableAutoCreation]  该查询不会隐式的排除具有Prefab组件的实体Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithEntityQueryOptions(EntityQueryOptions.IncludePrefab).Run();//Schedule 多线程并发执行 ; WithoutBurst 不使用Burst编译Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithoutBurst().Schedule();//ScheduleParallel 配合Job 多线程并行执行 WithBurst 使用Burst编译Entities.ForEach((ref Translation trans) =>{trans.Value = new Unity.Mathematics.float3(0, 5, 0);}).WithBurst().ScheduleParallel();query.Dispose();array.Dispose();}protected override void OnStopRunning(){Debug.Log("OnStopRunning");}protected override void OnDestroy(){Debug.Log("OnDestroy");}
}

http://www.yayakq.cn/news/713889/

相关文章:

  • 购物网站logowordpress 备案
  • 网页设计模板素材代码嘉兴有能做网站优化
  • 沈阳市城市建设学院官方网站网站建设综合训练报告
  • 网站制作出租辽宁建设厅勘察设计网站
  • 济南高端网站建设公司网站被封了怎么办
  • 太原seo网站排名做页面设计的软件
  • 月付商城网站建站河北邢台刚刚发布的紧急通知
  • 网站和软件有什么区别宁波网站推广优化联系电话
  • 郑州电力高等专科学校电话南京seo推广公司
  • 网站建设需要多大的服务器网站怎么做图片转链
  • 做企业网站设计方案wordpress收录慢
  • 四川省住房建设厅网站进不去房产网站内容建设规划
  • 网站 手机版网站用户建设的设计与实现
  • 网站开发的方法和步骤网站域名如何使用
  • 家居公司网站建设方案ppt办公室装修效果图图片
  • 做ppt的图片素材网站网站策划的内容包含了什么?
  • 学做网网站论坛小程序++wordpress
  • 省直部门门户网站建设长春大学
  • 大沥网站开发房产最新消息今天新闻
  • 南宁网站制作公wordpress文章总是被修改
  • 佛山网站建设哪家评价高网站如何生成app
  • 手机网站 跳转wordpress分类设置主题
  • 谁知道陕西省建设监理协会的网站求网站都懂得
  • 合肥大型网站建设医疗云网站建设
  • 网站图片加载顺序51个人网站
  • 怎样做网站赚钱wordpress 不能提交评论
  • 展会网站建设老河口市建设局网站
  • 网站开发方案及报价单什么做直播网站好
  • 广州网站建设咨询电话手机网站模版
  • 织梦网站footer美化东莞大岭山做网站公司