Search Unity

[Solved] Issue with Length injection for Entities package 12-preview.8

Discussion in 'Entity Component System' started by zulfajuniadi, Jul 4, 2018.

  1. zulfajuniadi

    zulfajuniadi

    Joined:
    Nov 18, 2017
    Posts:
    117
    After upgrading entities to 12-preview.8 I'm getting an error saying that "Length" has to be initialized with the readonly attribute even though I've already marked it as ReadOnly.

    Going through the code it seems that there's a bug on Unity.Entities.InjectComponentGroup.cs #221:

    upload_2018-7-5_2-28-42.png

    As the injection is done in via a struct, the Length cannot be initialized upfront, thus line 225 will never be called.

    Below are some screenshots of the issue:

    upload_2018-7-5_2-31-31.png

    upload_2018-7-5_2-33-3.png

    Is it only me or does anyone else face the same problem?

    Right now the workaround is getting the length from one of the injected arrays.
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
  3. zulfajuniadi

    zulfajuniadi

    Joined:
    Nov 18, 2017
    Posts:
    117
    Yeah that fixed the issue. Thanks.

    upload_2018-7-5_2-56-19.png
     
    Last edited: Jul 4, 2018