刚出来的时候用过一段时间,各种坑后放弃了,最近看到dots更新了,想重新捡起来玩玩
emmm,结果上来就卡主了,可以说是十分的蛋疼了,直接上解决代码吧
用的URP 2020 LTS ,话说,你这api改的也太离谱了吧
using UnityEngine;
using Unity.Entities;
using Unity.Transforms;
using Unity.Collections;
using Unity.Rendering;
using Unity.Mathematics;
public class TestEntity : MonoBehaviour
{
public Mesh mesh;
public Material material;
private void Start()
{
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
EntityArchetype entityArchetype = entityManager.CreateArchetype(
typeof(LevelComponent),
typeof(Translation),
typeof(RenderMesh),
typeof(LocalToWorld),
typeof(RenderBounds),
typeof(WorldRenderBounds),
typeof(BuiltinMaterialPropertyUnity_LightData),
typeof(WorldToLocal_Tag)
);
NativeArray<Entity> entities = new NativeArray<Entity>(2, Allocator.Temp);
entit

博客作者在尝试使用更新后的Unity URP(Universal Render Pipeline)时遇到了问题,发现API有所改变,导致在创建和配置Entity时遇到困难。通过分享解决代码,作者详细展示了如何在URP2020LTS中创建并设置Entity,包括LevelComponent、Translation、RenderMesh等组件。同时,提到了在Hybrid0.50中为RenderMesh设置layermask的额外步骤,表明Unity的新API可能带来一些额外的学习成本。
最低0.47元/天 解锁文章
1617

被折叠的 条评论
为什么被折叠?



