Hello.
My Unity Editor crashes when I run this code, using ECS and HDRP in Unity 2019.3.14:
// 1
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, null);
// 2
EntityArchetype archetype = entityManager.CreateArchetype(
typeof(Translation),
typeof(RenderMesh),
typeof(RenderBounds),
typeof(LocalToWorld));
// 3
Entity grassEntity = entityManager.CreateEntity(archetype);
// 4
entityManager.AddComponentData(grassEntity, new Translation { Value = new Vector3(0, 0, 0) });
entityManager.AddSharedComponentData(grassEntity, new RenderMesh
{
mesh = grassBladeMesh,
material = grassBladeMaterial
});
The Unity Editor when I apply the material. Here’s some more info:
-
The mesh is a Unity primitive Cube.
-
The material is any material using a Shader created with Shader Graph.
-
If I use a material made with a built-in Shader, the Unity Editor does not crash.
-
I’ve tested this with graphs that are new, blank, un-edited Unlit Master Nodes.
-
Applying the material to the entity crashes the Editor, and using a Prefab with that material applied also crashes the Editor.
-
I tried copying the Shader as text and pasting it into a blank .shader file, but the method still crashed the Editor.
Here’s what the crash log said:
Assertion failed on expression: 'data->elementSize'
Am I doing something wrong, is this not supported, or is it a bug?
(Sorry, not sure if this should go in /shader-graph or /ecs)