using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Entities;
using Unity.Rendering;
using Unity.Transforms;
using Unity.Mathematics;
public class Testing : MonoBehaviour
{
[SerializeField] Mesh mesh;
[SerializeField] Material material;
EntityManager entityManager;
void Start()
{
entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity(
typeof(RenderMesh),
typeof(LocalToWorld),
typeof(Translation),
typeof(RenderBounds),
typeof(NonUniformScale),
typeof(WorldRenderBounds),
typeof(Scale)
);
entityManager.SetSharedComponentData(entity, new RenderMesh
{
mesh = mesh,
material = material
});
entityManager.SetComponentData(entity, new RenderBounds
{
Value = new Bounds(Vector3.zero, Vector3.one * 5f).ToAABB()
});
entityManager.SetComponentData(entity, new Scale
{
Value = 1f
});
}
}
Anyone knows what’s going on? I am probably missing some component, not sure