2020.1 Beta 5 & Latest related packages for Hybrid Render V2 - No Entities Showing
(I’ve already asked in the DOTS related sub-forum, I thought I’d give it a try in the beta forum next)
I feel this is something simple I’m overlooking?
If I add a sphere with a Convert to Entity component, that will show up in Play Mode. But the following code will no longer (it worked fine in 2019.3 with HR V1) present the Entities I expected at Play Mode time.
Any ideas why not? (I’m using URP)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using Unity.Rendering;
using Unity.Jobs;
public class CreateCapsuleSystem : JobComponentSystem
{
protected override void OnCreate()
{
base.OnCreate();
for (int i = 0; i < 100; i++)
{
var instance = EntityManager.CreateEntity(
ComponentType.ReadOnly<LocalToWorld>(),
ComponentType.ReadWrite<Translation>(),
ComponentType.ReadWrite<Rotation>(),
ComponentType.ReadWrite<NonUniformScale>(),
ComponentType.ReadOnly<RenderMesh>()
);
float3 position = new float3(UnityEngine.Random.Range(-10, 10), 0, UnityEngine.Random.Range(-10, 10));
float scale = UnityEngine.Random.Range(1, 10);
EntityManager.SetComponentData(instance,
new LocalToWorld
{
Value = new float4x4(rotation: quaternion.identity, translation: position)
});
EntityManager.SetComponentData(instance, new Translation { Value = position });
EntityManager.SetComponentData(instance, new Rotation { Value = new quaternion(0, 0, 0, 0) });
EntityManager.SetComponentData(instance, new NonUniformScale { Value = new float3(scale, scale, scale) });
var rHolder = Resources.Load<GameObject>("ResourceHolder").GetComponent<ResourceHolder>();
EntityManager.SetSharedComponentData(instance,
new RenderMesh
{
mesh = rHolder.theMesh,
material = rHolder.theMaterial
});
}
}
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
return inputDeps;
}
}