Search Unity

Mesh Instance Renderer Not Working in Windows Standalone Build

Discussion in 'Data Oriented Technology Stack' started by caseyc, Jan 4, 2019.

  1. caseyc

    caseyc

    Joined:
    Jul 2, 2012
    Posts:
    15
    I've been messing around with unity ECS the past few days but have hit a snag. I am creating several entities with a position, rotation and mesh instance renderer component attached, and am assigning the mesh and material to the instance renderer. Everything looks correct in the editor with all entities rendering as expected, but when I build for standalone windows none of the entities are visible. I am using a red standard shader with
    gpu instancing enabled, and the standard cube mesh that comes with unity.

    Stuff I have tried:
    - Putting a gameobject in the scene with the same mesh/material as is being used for the entities, it shows up as expected.
    - Setting the Instancing Variants to "Keep All" in the graphics settings.
    - Debug logging to make sure the entities are actually being made (they are).

    I also have some debug text in to monitor the performance of my other job systems and they seem to be running correctly so I'm pretty sure that jobs are working as expected.

    Are there any other components that I should add to an entity to make sure it is rendered? What settings am I missing in unity that might be causing the entities to not appear in a standalone build?

    Edit: Should have mentioned I am using the current release of unity 2018.3, the project was started on the unity 2018.3 beta and i recently switched it over. I checked in the plugin manager and all the plugins for jobs seem to be up to date.

    Thanks for any assistance!
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,656
    Just to check a few things.

    Have you looked at the log files?
    Are you using windows IL2CPP by any chance?
     
    caseyc likes this.
  3. caseyc

    caseyc

    Joined:
    Jul 2, 2012
    Posts:
    15
    I am using windows IL2CPP and I did check the logs, I saw my debug logs in there but no errors or any other output. Thanks!
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,656
    caseyc likes this.
  5. caseyc

    caseyc

    Joined:
    Jul 2, 2012
    Posts:
    15
    Awesome! I'll take a look right now thanks!
     
  6. caseyc

    caseyc

    Joined:
    Jul 2, 2012
    Posts:
    15
    So I put a file into my assets folder called link.xml with these contents:

    Code (CSharp):
    1. <linker>
    2.     <assembly fullname="Unity.Rendering.Hybrid" preserve="all"/>
    3. </linker>
    But the entities are still not showing up in the build. It looks like in the thread you linked the person was having an error, I have checked the logs several times and definitely don't have one. Any other ideas?

    Thanks!
     
  7. caseyc

    caseyc

    Joined:
    Jul 2, 2012
    Posts:
    15
    So I played around with it some more and added a few more assemblies to the link and it works now! For anyone who is interested here is the link.xml i am using, I'm sure some of this stuff doesn't need to be in here but it works for now.

    Code (CSharp):
    1. <linker>
    2.     <assembly fullname="Unity.Rendering.Hybrid" preserve="all"/>
    3.   <assembly fullname="Unity.Entities" preserve="all"/>
    4.   <assembly fullname="Unity.Entities.Hybrid" preserve="all"/>
    5.   <assembly fullname="Unity.Transforms" preserve="all"/>
    6.   <assembly fullname="Unity.Transforms.Hybrid" preserve="all"/>
    7. </linker>
    Thanks again for the help!
     
    addent likes this.
  8. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,656
    I'm just lazy and use a generic Unity.* preservation.

    Even though I'm not developing for mobile, it's such a small library anyway the file size change is minimal.
     
  9. caseyc

    caseyc

    Joined:
    Jul 2, 2012
    Posts:
    15
    That is a much better solution lol.
     
  10. josencv

    josencv

    Joined:
    Aug 5, 2014
    Posts:
    1
    Thanks guys, you saved me a lot of time. I did a lot of tests and these were the packages that I had to add in the link.xml file:

    Code (CSharp):
    1. <linker>
    2.   <assembly fullname="Unity.Rendering.Hybrid" preserve="all"/>
    3.   <assembly fullname="Unity.Transforms.Hybrid" preserve="all"/>
    4. </linker>
    5.  
    Cheers,
     
  11. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    277
    How do you do this? Would something like <assembly fullname="Unity.*" preserve="all"/> work?
     
  12. addent

    addent

    Joined:
    Apr 27, 2019
    Posts:
    18
    Tried this in Unity 2019.2.4f1, the Unity.* doesn't work:
    Code (CSharp):
    1. <linker>
    2.    <assembly fullname="Unity.*" preserve="all"/>
    3. <linker>
    But this one by caseyc does:
    Code (CSharp):
    1. <linker>
    2.     <assembly fullname="Unity.Rendering.Hybrid" preserve="all"/>
    3.   <assembly fullname="Unity.Entities" preserve="all"/>
    4.   <assembly fullname="Unity.Entities.Hybrid" preserve="all"/>
    5.   <assembly fullname="Unity.Transforms" preserve="all"/>
    6.   <assembly fullname="Unity.Transforms.Hybrid" preserve="all"/>
    7. </linker>
    Any reason why the Unity.* version would not work? I'm totally okay with bigger build sizes if it means I don't have to fight with IL2CPP stripping all the time.