Search Unity

Passing a method reference to Job

Discussion in 'Entity Component System' started by Vorren, Jun 24, 2018.

  1. Vorren

    Vorren

    Joined:
    Oct 24, 2014
    Posts:
    19
    Is it possible to pass a method reference to a Job?
    Reasoning is that this would allow to build more modular and generic jobs that can take input of certain type, output of certain type and a delegate that actually does the computation.
    This would allow to jobify existing code more easily.
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Use method in a struct approach like what `IComparer<T>` does?

    Also in the future (C# 8.0?) we could define base logic of method in an interface and struct can use multiple interfaces. That might provide an another way to make a reusable job code by adding interface with base code directly to the job.