I create my own ECS World And name it "WORLDX" I then i called the scriptbehaviowupadte.updateplayerloop() on my world. Then i attach rendermeshsystemv2 to the presentationgroup and i see some warring and i attached all the required components that the warring says. And when i am going to spawn entity the editor chrashes.
my code-
using Unity.Entities;
using Unity.Rendering;
using Unity.Physics;
using Unity.Mathematics;
using Unity.Jobs;
using UnityEngine;
public class WorldManager : MonoBehaviour
{
public GameObject Prefab;
private Entity Player;
private EntityManager manager;
public UnityEngine.Mesh mesh;
public UnityEngine.Material material;
private World MyWorld;
private InitializationSystemGroup initializationSystem;
private SimulationSystemGroup simulationSystem;
private PresentationSystemGroup presentationSystem;
private ComponentSystemBase RenderSystemV2;
private ComponentSystemBase LodRequireMentSystem;
private ComponentSystemBase RenderBoundUpdateSystem;
private ComponentSystemBase MissingRenderBound;
void Start()
{
MyWorld = new World("WORLDX");
ScriptBehaviourUpdateOrder.UpdatePlayerLoop(MyWorld);
RenderSystemV2 = MyWorld.GetOrCreateSystem();
LodRequireMentSystem = MyWorld.GetOrCreateSystem();
RenderBoundUpdateSystem = MyWorld.GetOrCreateSystem();
MissingRenderBound = MyWorld.GetOrCreateSystem();
presentationSystem = MyWorld.GetOrCreateSystem();
presentationSystem.AddSystemToUpdateList(RenderSystemV2);
presentationSystem.AddSystemToUpdateList(LodRequireMentSystem);
presentationSystem.AddSystemToUpdateList(RenderBoundUpdateSystem);
presentationSystem.AddSystemToUpdateList(MissingRenderBound);
RenderSystemV2.Update();
LodRequireMentSystem.Update();
RenderBoundUpdateSystem.Update();
MissingRenderBound.Update();
manager = MyWorld.EntityManager;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
EntityArchetype archetype = manager.CreateArchetype(typeof(Unity.Transforms.Translation), typeof(Unity.Transforms.LocalToWorld),
typeof(Unity.Rendering.RenderMesh));
Entity entity = manager.CreateEntity(archetype);
manager.SetSharedComponentData(entity, new RenderMesh { mesh = mesh, material = material });
}
}
}
Help Please if i am doing some thing wrong.
@PhilSA
@Joachim_Ante
@duck
↧