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

about lambda functions

Discussion in 'Entity Component System and C# Job system' started by laurentlavigne, Nov 30, 2018.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,013
    So this is the new way. Why not this instead?
    Code (CSharp):
    1. void OnUpdate(ref Spawner spawner, in Position position)
    2. {
    3. }
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    785
    Who is the caller of OnUpdate with custom parameters? If it is called "from below" then listed types would have to be in the class name's generic (similar to IJobProcessComponentData) so the caller knows what OnUpdate to call, or we have to use reflection on the class to find any method named exactly OnUpdate (because not using override) and extract argument parameters. That might be error prone, and we could have only one set of in out data to work for one system.

    The lambda design's "ForEach" works more like GetComponentGroup, where the type specified would be registered as a reader writer with the system on the first call (at runtime). And it would allow you to do multiple of ForEach.
     
    laurentlavigne likes this.
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,013
    Convinced!
    Thanks.