Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Preview 21 issues

Discussion in 'Entity Component System and C# Job system' started by Tazadar66, Dec 5, 2018.

  1. Tazadar66

    Tazadar66

    Joined:
    Aug 27, 2013
    Posts:
    54
    Hello I dont know how to replaces these calls :

    entityManager.GetComponentDataFromEntity and entityManager.GetBufferFromEntity

    I have these errors :

    Assets/Scripts/Grid/Bootstraps/GridBootstrap.cs(178,89): error CS1061: 'EntityManager' does not contain a definition for 'GetComponentDataFromEntity' and no accessible extension method 'GetComponentDataFromEntity' accepting a first argument of type 'EntityManager' could be found (are you missing a using directive or an assembly reference?)

    Assets/Scripts/Grid/Bootstraps/GridBootstrap.cs(195,88): error CS1061: 'EntityManager' does not contain a definition for 'GetBufferFromEntity' and no accessible extension method 'GetBufferFromEntity' accepting a first argument of type 'EntityManager' could be found (are you missing a using directive or an assembly reference?)

    Thanks :)
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    785
    You have to let your system know when you want to use CDFE because system collects who read and write data. It is now have to be requested from inside ComponentSystem's code. (protected method)

    I don't know why GetBufferFromEntity is missing, but [Inject] BufferFromEntity inside the system code works. (as well as inject CDFE)
     
  3. BanJaxe

    BanJaxe

    Joined:
    Nov 20, 2017
    Posts:
    16
    ComponentSystem only has this.GetComponentDataFromEntity
    JobComponentSystem additionally has this.GetBufferFromEntity

    Not sure if there's a reason for that or just a missing feature for now.
     
  4. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    785
    I just added [Inject] BufferFromEntity<T> in ComponentSystem and can confirm that it works. Maybe just a mistake?
     
  5. BanJaxe

    BanJaxe

    Joined:
    Nov 20, 2017
    Posts:
    16
    I meant the public methods in the base classes, not using injection.

    JobComponentSystem inherits from ComponentSystemBase and adds:

    public BufferFromEntity<T> GetBufferFromEntity<T>(bool isReadOnly = false) where T : struct, IBufferElementData;
     
  6. Tazadar66

    Tazadar66

    Joined:
    Aug 27, 2013
    Posts:
    54
    Thanks for your help but my problem is that I need to use EntityManager from a bootstrap script and I don't have any access to these two methods now :(
     
  7. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    785
    If you can get a hold of EntityManager in your bootstrap script then just create a manager right there and call into its public method/update to do things.