Problem is not reproducible or outdated
No overload for method 'Schedule' takes 4 arguments
So i am having an Issue with Scheduling an IJobParallelForTransform job
Unity Doc say :
public static Unity.Jobs.JobHandle Schedule(T jobData, int arrayLength, int innerloopBatchCount, Unity.Jobs.JobHandle dependsOn);
Parameters: jobData, arrayLength, innerloopBatchCount, dependsOn
base on that when i try to Schedule a job for ecample
Job Code
public struct Myjob : IJobParallelForTransform
{
public NativeArray<float> PosXJ;
private Vector3 PosJ;
public void Execute(int index, TransformAccess transform)
{
PosJ = new Vector3(PosXJ[index], 0f, index);
transform.position = PosJ;
}
}
Main code:
*private int size = 100;
public Transform prefab;
private Transform[] points;
private Myjob myjob;
private JobHandle handle;
NativeArray<float> posX;
NativeArray<Vector3> pos;
TransformAccessArray transforms;
private void Start()
{
points = new Transform[size * size];
posX = new NativeArray<float>(size, Allocator.Persistent);
pos = new NativeArray<Vector3>(size, Allocator.Persistent);
transforms = new TransformAccessArray(0, -1);
transforms.capacity = points.Length;
for (int x = 0; x < points.Length; x++)
{
points[x] = Instantiate(prefab, transform);
transforms.Add(points[x]);
}
}
private void Update()
{
for (int x = 0; x < size; x++)
{
posX[x] = x;
}
myjob = new Myjob()
{
PosXJ = posX
};
handle = myjob.Schedule(transforms, points.Length, 16, handle);
}
private void OnDisable()
{
handle.Complete();
posX.Dispose();
pos.Dispose();
transforms.Dispose();
}*
up on executing this, unity logs me with this error No overload for method 'Schedule' takes 4 arguments
also I cannot able to leave 4th parameter empty like this below, its still errors me for requirement of 4th parameter.
handle = myjob.Schedule(transforms, points.Length, 16);
However Error disappears in either below cases, handle = myjob.Schedule(points.Length, 16); and handle = myjob.Schedule(transforms);
my plan is to instantiate million Cubes with applied already shared, and then later to perform Sine calculation on each of them, for now I am just using Jobs system, kind of non ECS way, but learning it on the way.
sorry for not providing more details (if any, idk), I am still learning, anyway thanks in advance for taking interest in helping me :)
Answer by SauronDark · Dec 18, 2018 at 01:41 PM
I realized some logical problems too in my Example code, but never mind as long as these are not related with my main question, after all this is just an example code.
but i'd be apreaciate if someone provide me better way to change transform of GameObject via Jobs system, thanks again