Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Job to spawn entities runs in Editor but not in Build

Discussion in 'Entity Component System' started by Valda, Feb 8, 2023.

  1. Valda

    Valda

    Joined:
    Jan 18, 2017
    Posts:
    2
    I tried to adapt this official entities tutorial to display sprites instead of the tanks.

    TL;DR : I can create and render entities with a system + IJobEntity + bakers and all that good stuff correctly in the editor, but the entities are completely non-existent in a Windows build.

    So, I am sure there are many things not optimal about the way I am doing this but it just a huge red flag that it isn't building correctly and I just can't figure it out. This is what it looks like in the editor:

    Screenshot 2023-02-07 211526.png

    The player from the build only has the cube. No error messages in the attached debugger.

    I added the cube to make sure that the scene was loading correctly. I added the repro above to try to save a bunch of screenshots and code snippets but after attaching a debugger to the build, but I know that the job to actually create entities is not executing. I just have no idea why.

    Any insights at all would be incredibly appreciated!
     
    Last edited: Feb 8, 2023
  2. Valda

    Valda

    Joined:
    Jan 18, 2017
    Posts:
    2
    This has been solved, but I still don't quite understand why.

    The issue was essentially that the Job Scheduling was not working on the first Update call for the System. So, on the first update, I called ScheduleJob X times, I increased the count of the number of sprites I thought were spawned by X, but the jobs were never scheduled and no sprites were spawned.

    Replacing this with a query works, but it is still unclear why it took 10 frames for the job scheduler to work.
     
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,148
    Subscenes load asynchronously in builds, whereas in the editor they are preloaded.