Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    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. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Welcome!

Discussion in 'Entity Component System and C# Job system' started by MartinGram, Mar 20, 2018.

  1. Tudor-Nita

    Tudor-Nita

    Joined:
    Dec 10, 2009
    Posts:
    332
    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:
    110
    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:
    110
    Updating Visual Studio 2017 to version 15.6.6 helped
     
  5. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    110
    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:
    398
    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:
    406
    Unity2018.2.0b2 is aviable and does support ecs.

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

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    398
    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:
    398
    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:
    25
    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:
    14
  13. Spy-Shifty

    Spy-Shifty

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

    MartinGram

    Unity Technologies

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

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

    gormulent

    Joined:
    Dec 15, 2016
    Posts:
    29
    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. gormulent

    gormulent

    Joined:
    Dec 15, 2016
    Posts:
    29
    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.
     
  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. gormulent

    gormulent

    Joined:
    Dec 15, 2016
    Posts:
    29
    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:
    44
    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. gormulent

    gormulent

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

    Deadcow_

    Joined:
    Mar 13, 2014
    Posts:
    44
    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:
    406
  24. uani

    uani

    Joined:
    Sep 6, 2013
    Posts:
    54
    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:
    49
    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:
    53
    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:
    49
    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:
    173
    can you post your manifest file and your unity version?
     
  29. PeterB

    PeterB

    Joined:
    Nov 3, 2010
    Posts:
    321
    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:
    49
    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:
    164
    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:
    4,201
    It will be in the next package release.
     
    Micz84 likes this.
  33. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    153
    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:
    173
    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:
    406
    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:
    153
    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.
     
    Antypodish, johnnyt, noio and 4 others like this.
  38. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    13
    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:
    153
    Excellent! I am glad to hear that.