Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Welcome to the DOTS forums!

Discussion in 'Entity Component System' started by MartinGram, Mar 20, 2018.

Thread Status:
Not open for further replies.
  1. Tudor_n

    Tudor_n

    Joined:
    Dec 10, 2009
    Posts:
    359
    The simplest explanation I can come up with is:
    Without a job system, those threads would do nothing for most of the time and then you'd have to sync them with the main thread anyway. A waste of 2 threads, really. A decent job system ( assuming unity is using a fibre-like system underneath ) can really put 'dem cores to work.

    The end result is:
    The user-facing part of the job system will make it easier for gameplay programmers to parallelize their own stuff. And it will do so very efficiently.
     
    Shadowing likes this.
  2. TBbadmofo

    TBbadmofo

    Joined:
    Apr 1, 2014
    Posts:
    14
    I tried deleting the library folder and the .sln and .csproj file. The .sln and .csproj files will not regenerate, even if I reimport all or Assets -> Open C# Project and opening a script makes VS say there is no .sln file. The library folder doesn't generate UnityAssemblies and the PlayerDataCache folders. Also the project wouldn't stay upgraded. Every time I closed it it would always have to update to 12 again. Figured out I had to dirty the project and save for it to stick to that version.
     
  3. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    475
    Hi!
    I am developer of asset from Asset Store called Imposter System.
    I really want to start research ECS to implement in my project. Actually I need to rework whole system(new architecture) to work with ECS. Have you some collaborative program? Because I already have questions and problems that can't be solved by myself. :(

    Maybe there is no way to use ECS in my purpose, only Job System...
     
  4. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    475
    Updating Visual Studio 2017 to version 15.6.6 helped
     
  5. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    475
    Before this update I had opportunity to look at source code of ECS, and even change it. But now I cant. Is this expected behavior?

    I created new project, setup editor to work with ECS. Created new object in scene.
    Added following components:
    1. GameObjectEntity
    2. PositionComponent
    3. HeadingComponent (change the value to not zero)
    4. MoveForwardComponent
    5. MoveSpeedComponent (change value to not zero)
    I expacted that this would be enough to move object with Unity.Transforms.TransformSystem. What I'm doing wrong?


    Also I tried to write my own sync position system. Like in TwoStickHybrid.SyncTransformSystem example project. Here is code:
    Code (CSharp):
    1. using Unity.Collections;
    2. using Unity.Entities;
    3. using Unity.Mathematics;
    4. using Unity.Transforms;
    5. using UnityEngine;
    6.  
    7. public class SyncPositionSystem : ComponentSystem
    8. {
    9.     public struct Data
    10.     {
    11.  
    12.         [ReadOnly] public Position Position;
    13.         [ReadOnly] public Heading Heading;
    14.         public Transform Output;
    15.     }
    16.  
    17.     protected override void OnUpdate()
    18.     {
    19.         foreach (var entity in GetEntities<Data>()) // here is error
    20.         {
    21.             float3 p = entity.Position.Value;
    22.             float3 h = entity.Heading.Value;
    23.             entity.Output.position = p;
    24.             if (!h.Equals(new float2(0f, 0f)))
    25.                 entity.Output.rotation = Quaternion.LookRotation(h, new float3(0f, 1f, 0f));
    26.         }
    27.     }
    28. }
    And got following error:
    ArgumentException: SyncPositionSystem+Data.Position must be an unsafe pointer to the Unity.Transforms.Position. Like this: Unity.Transforms.Position* Position;
    Unity.Entities.ComponentGroupArrayStaticCache..ctor (System.Type type, Unity.Entities.EntityManager entityManager, Unity.Entities.ComponentSystemBase system) (at C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.entities@0.0.11/Unity.Entities/Iterators/ComponentGroupArray.cs:99)
    Unity.Entities.ComponentSystemBase.GetEntities[T] () (at C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.entities@0.0.11/Unity.Entities/ComponentSystem.cs:183)
    SyncPositionSystem.OnUpdate () (at Assets/Scripts/SyncPositionSystem/SyncPositionSystem.cs:22)
    Unity.Entities.ComponentSystem.InternalUpdate () (at C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.entities@0.0.11/Unity.Entities/ComponentSystem.cs:247)
    Unity.Entities.ScriptBehaviourManager.Update () (at C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.entities@0.0.11/Unity.Entities/ScriptBehaviourManager.cs:82)
    Unity.Entities.ScriptBehaviourUpdateOrder+DummyDelagateWrapper.TriggerUpdate () (at C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.entities@0.0.11/Unity.Entities/ScriptBehaviourUpdateOrder.cs:59)
     
  6. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    b12 has performance issues that were solved on b13, is there any chance we can get a build based on b13 anytime soon?
     
    FROS7 likes this.
  7. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
    Unity2018.2.0b2 is aviable and does support ecs.

    https://unity3d.com/de/unity/beta-download
     
  8. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Great, a little bit hard to set up but no problem, everything seems ok except for the fact that I can't find a way to open the entity debugger window.
     
  9. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    I don't know what's going on, I'm on 2018.2.0b2 with an empty project and it seems like Unity is trying to complie the entity page over and over agian. And it always displays the same error messages:


    Read only asset Packages/com.unity.entities/Unity.Transforms/TransformInputBarrier.cs has no meta file.

    C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.entities@0.0.11/Unity.Entities.Editor/ExtraTypesProvider.cs(6,32): error CS0234: The type or namespace name `Build' does not exist in the namespace `UnityEditor.Experimental'. Are you missing an assembly reference?

    C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.entities@0.0.11/Unity.Entities.Properties/TypeInformation.cs(150,13): warning CS0162: Unreachable code detected

    I'm I missing a crucial step?
     
  10. Demkeys

    Demkeys

    Joined:
    Nov 14, 2014
    Posts:
    32
    Have you tried updating the Burst package from the Package Manager?

    I installed Unity2018.2.0b2 and I didn't see the Burst or Mathematics packages. I had to set the dependencies in the manifest.json file and then they appeared in the Package Manager. Am I missing some info here?
     
  11. Prastiwar

    Prastiwar

    Joined:
    Jul 29, 2017
    Posts:
    125
    I've got these errors too. I solved them by following:
    https://forum.unity.com/threads/2018-2-transforminputbarrier-meta-error.527433/
    https://forum.unity.com/threads/unity-2018-2-beta-1-and-ecs.527385/
     
  12. EvansT

    EvansT

    Joined:
    Jan 22, 2015
    Posts:
    22
  13. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
  14. MartinGram

    MartinGram

    Administrator

    Joined:
    Feb 24, 2017
    Posts:
    72
    Short update on builds.

    The ECS and Burst packages are compatible with 2018.1 and onwards.
     
    siggigg and Demkeys like this.
  15. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    71
    Is it possible to use com.unity.mathematics without using the ECS code?
     
  16. Prastiwar

    Prastiwar

    Joined:
    Jul 29, 2017
    Posts:
    125
    Of course. You can use jobs without ECS, so you should be able to use also this math library. If you don't use c# Job System I don't think there will be any performance improvement from using it without burst compiler but of course you can use it. It's "just" math library.
     
  17. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    71
    Sure - I just want to use the job system / burst compiler / mathematics library without having to include the ECS code, it's buggy as hell.
     
    piXXem likes this.
  18. Prastiwar

    Prastiwar

    Joined:
    Jul 29, 2017
    Posts:
    125
    It's sorry to hear that you have so many bugs. I don't have any, but pure ECS is very very limited atm. It was be great if you would share bugs with Unity's staff so they can fix them.
     
  19. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    71
    Sure thing - I've been an engine programmer in the game industry for years too, so another reason is I just want full control. It's frustrating using a sealed API. But to each his own. :)
     
  20. Deadcow_

    Deadcow_

    Joined:
    Mar 13, 2014
    Posts:
    133
    Is there some changelog and roadmap for ecs? I bet I saw here somewhere something like "we're working on the reactive systems" and I'd like to read more about features in development and eta's. This info can help to schedule development
     
  21. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    71
  22. Deadcow_

    Deadcow_

    Joined:
    Mar 13, 2014
    Posts:
    133
    Yeah, I bet guys working on ECS have their own roadmap. Unity's roadmap is far from detailed. At least I'd like to hear more about reactive systems
     
  23. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
  24. uani

    uani

    Joined:
    Sep 6, 2013
    Posts:
    232
    Hi, which dependencies have to be set to what to be able to use the Burst and Mathematics package?
     
    Habut likes this.
  25. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    I'm doing an Udemy course on the Job System and ECS. The Job System I got working however ECS - no luck. I've tried doing what they say in the course (update .net to 4.0 and change the json file in the packages folder) but nothing seems to work - I cannot get Entities to appear in the Package Manager.

    Whenever I try to use someone's json file example (eg: Unity @ Github) I get an error:
    Code (CSharp):
    1. An error occurred while resolving packages:
    2.   Project has invalid dependencies:
    3.     com.unity.entities: Cannot connect to registry: undefined
    4.   One or more packages could not be added to the local file system:
    5.     com.unity.package-manager-ui: failed to fetch from registry: https://packages.unity.com/com.unity.package-manager-ui
    6.  
    7. A re-import of the project may be required to fix the issue or a manual modification of X:/.../Packages/manifest.json file.
    Surely unity can standardize the process so that anyone can use the ECS or JobSystem if they need to.
     
  26. Enrico-Monese

    Enrico-Monese

    Joined:
    Dec 18, 2015
    Posts:
    77
    I don't know if you put the X in the path to anonimize it, but if that's not the case it could mean that you are working on and external drive perhaps? That's kinda know to mess with stuff sometimes.
     
  27. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    Correct, I put the X and the ... to anonymize it. I've reimported the project and it doesn't fix it. It might be possible to get it working but so far I've tried my teacher's advice, Youtube and Githubs advice, Unity's advice and nothing works. Only the Job System works and I cannot get Entities to become visible in the package manager.
     
  28. starikcetin

    starikcetin

    Joined:
    Dec 7, 2017
    Posts:
    340
    can you post your manifest file and your unity version?
     
  29. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    366
    Adding the following to the manifest file list of dependencies works for me:
    Code (CSharp):
    1.     "com.unity.mathematics": "0.0.12-preview.10"
    2.  
    The version above is the latest release.
     
  30. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    Thanks for your help, after all of this, I was getting some help from my course staff and I noticed in the error it would say "Could not connect" and so I disabled my firewall and now it works.
     
  31. Micz84

    Micz84

    Joined:
    Jul 21, 2012
    Posts:
    447
    Why EntityCommandBuffer only has a generic version of RemoveComponent while EntityManager has a generic one and one where component type can be passed by an argument? Will it be added soon?
     
  32. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    It will be in the next package release.
     
    Micz84 likes this.
  33. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    244
    Can you send me a link to that Udemy course? I am curious to check it out. Thanks! You can respond here or to my email: mike at unity3d.com
     
  34. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    ECS is fail.
    Better fast developing than program performance.
     
    johnnyt likes this.
  35. starikcetin

    starikcetin

    Joined:
    Dec 7, 2017
    Posts:
    340
    If you are making a snake or tetris clone, yes. Some of us work on bigger things where performance matter.

    Besides, ECS also provides a more natural way of coding; especially in the domain of game development.
     
  36. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
    Why?

    I completely disagree with that!

    It's realy important to have a well structured code. It's easy to maintain and easy to add features. Also performance is always importent!

    All this can be achieved more easily with ECS than with OOP!
     
  37. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    244
    In a way, I agree with you. Right now, ECS does require you to sacrifice the ease-of-use development workflows that we have honed over the years.

    That being said, ECS is a long strategy for us. Eventually, you will get the best of both worlds as we convert our workflows to work with entities directly in the editor. As the technology matures, you'll be able to have your cake and eat it too.
     
  38. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    It's likely that Unity's initial popularity was greatly helped by how easy it is to get something up and running.

    However, after a couple of weeks learning curve with ECS, converting some of my simulation systems over and then seeing 6k of my RTS units marching to war vs a couple hundred; That was the wow moment for me. I'm not even really using the jobs system in terms of maximising concurrency yet but the burst compiler alone is giving me a x20 speed switch, which is massive!

    Thank you for prioritising performance Unity ECS team! Good for you!

    Very much looking forward to see how the ECS/Jobs/Burst continue to develop. In particular looking forward to the floating point determinism...

    Saves me having to do my own native C++ plugin for this stuff.
     
    Last edited: Sep 26, 2018
  39. iperov

    iperov

    Joined:
    Dec 13, 2015
    Posts:
    36
    I was wrong.
    ECS is superior awesome cool feature.
     
  40. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    244
    Excellent! I am glad to hear that.
     
  41. Ofx360

    Ofx360

    Joined:
    Apr 30, 2013
    Posts:
    155
    Any knowledge on about when more systems will be making their way into ECS - like Physics, AI/Nav, Collision, UI, Animation, etc?

    Or are those things still a ways off?
     
    hottabych and alesmasiar like this.
  42. hottabych

    hottabych

    Joined:
    Apr 18, 2015
    Posts:
    107
    Is it necessary to use your Unity.Mathematics library in order to compile the game with Burst? Or it's just an option and I can proceed with standard Vector3/Quaternion and Burst is still able to recognize it?
    Because I began to examine your ECS Samples and noticed that you use Unity.Mathematics everywhere, and that confused me.
     
  43. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    669
    Burst natively understands the Unity.Mathematics types and functions and can vectorize them with native Machine SIMD functions.

    It can still do general optimizations with the old math types but the intention is to move away from those as you won't get the full optimizations.
     
    hottabych likes this.
  44. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    244
    Yep, what recursive said ^
     
  45. TrueJollyRoger

    TrueJollyRoger

    Joined:
    Dec 23, 2017
    Posts:
    9
    OMG. Thank you guys, for doing it. ECS is something that was bothering me for years (before I learned it's named ECS, lol) and now Unity are implementing this as a new paradigm. It's about time for games to development to get something unique and implemented in such a wide scale.
    Do you have any gathering or classes in Bay Area to come, listen, learn and discuss it? It so promising to miss!
     
  46. Greetings from San Jose. AFAIK they hold Unity meetups in San Francisco (unfortunately because of my day job and stuff I have never had the chance to check out). https://www.meetup.com/Unity-official/
     
  47. TrueJollyRoger

    TrueJollyRoger

    Joined:
    Dec 23, 2017
    Posts:
    9
    Greetings from Fremont. Oh. thank you for the link. You right, going from San Jose to SF during evening traffic would be nightmare.
     
  48. emadkh

    emadkh

    Joined:
    Aug 23, 2013
    Posts:
    21
    I thought that Unity Entity package is going to be something that has a release every week or at least biweekly. (This is what Unity said in Unite talks), but haven't seen a new release for almost two months.
    When can we expect the next release?
     
    NotaNaN and NeatWolf like this.
  49. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    502
    Havok pricing and hopefully first release soonish... originally targeted for June, maybe this is part of the hold up? dunno. Hope it's solo indie friendly... but yeah it's been ages, hopefully lots of goodies and fixes coming.
     
    NeatWolf likes this.
  50. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Yup, it's also my guess. Probably it's going to match with the release of either 2019.2.1f1 or 2019.3.1f1 - I'm not worried, we're getting blazing fast updates now :D
    (maybe even a little bit too fast a few months ago :p)
     
Thread Status:
Not open for further replies.