Overriding the manual script creation for IJobForEach

Unfortunately I discovered that IJobForEach can only take a maximum of 6 components. Lucky, it is quite easy to copy and past a Job that holds 7. The only problem is that the file is created by IJobForEach.tt, a file that auto generates the IJobForEach files. Inside the files code it has:

List<Combination[]> GenCombinations()
{
    var combinations = new List<Combination[]>();
    for (int count = 1; count <= 6; count++)
    {
        var array = new Combination[count];
        for (var c = 0; c != array.Length; c++)
            array[c] = Combination.D;
     
        combinations.Add(array);
    }
    return combinations;
}

Which determines that amount if jobs that are created with increasing component size. I thought this would be easy, changing it to a 7 but it gets overridden every time Unity is opened and closed, setting it back to a 6, and finally overriding the IForEach job files. Unfortunately I have never worked with these files and have no idea a way to stop the files from either be overridden or changing the .tt file override. Preferable I could just stop the main files from being overridden but what ever works works.

If you open the scripts from file explorer (and not the Unity Editor), you can make changes to packages persist. The path should be something like C:\Users[your username]\AppData\Local\Unity\cache\packages\packages.unity.com if your on Windows.

1 Like

Thank you very much!