Search Unity

WebGL abort at null function when using ECS

Discussion in 'Web' started by Jomsss, Jan 20, 2020.

  1. Jomsss

    Jomsss

    Joined:
    Jun 19, 2017
    Posts:
    3
    Hey, I'm doing some tests with ECS and WebGL and keep getting an error on startup.

    Trace from a development build:
    There's an error message included as well:
    Here is the only script in the project:
    Code (CSharp):
    1. using Unity.Entities;
    2. using Unity.Mathematics;
    3. using UnityEngine;
    4.  
    5. public struct CustomComp : IComponentData
    6. {
    7.     public float3 data;
    8. }
    9.  
    10. public class TestSystem : ComponentSystem
    11. {
    12.     protected override void OnUpdate()
    13.     {
    14.         Entities.ForEach((ref CustomComp comp) =>
    15.         {
    16.             comp.data += 1;
    17.         });
    18.     }
    19. }
    20.  
    21. public class ECSTest : MonoBehaviour
    22. {
    23.     // Start is called before the first frame update
    24.     void Start()
    25.     {
    26.         EntityManager em = World.Active.EntityManager;
    27.         EntityArchetype zombArch = em.CreateArchetype(
    28.             typeof(CustomComp)
    29.         );
    30.  
    31.         for (int i = 0; i < 10000; i++)
    32.             CreateZombie(em, zombArch);
    33.     }
    34.  
    35.     void CreateZombie(EntityManager em, EntityArchetype archetype)
    36.     {
    37.         Entity ent = em.CreateEntity(archetype);
    38.  
    39.         em.SetComponentData(ent, new CustomComp
    40.         {
    41.             data = new float3(0,0,0)
    42.         });
    43.     }
    44. }

    I'm using 2019.2.16f1. Any ideas? Thanks!
     
    Last edited: Jan 20, 2020