I was looking for a way to get buffer data from inside a job and test how it works and if it is burstable
but I’ve already hit a wall as soon as i’ve started lol
https://docs.unity3d.com/Packages/com.unity.entities@0.0/manual/dynamic_buffers.html
var lookup = GetBufferFromEntity<EcsIntElement>();
var buffer = lookup[myEntity];
buffer.Append(17);
buffer.RemoveAt(0);
seems like it’s outdated or something is missing there, I keep getting this error
Assets\Scripts\TEST_Burst_DynamicBuffer\Sistemas\Sys_BurstDynamic_Test.cs(15,26): error CS0120: An object reference is required for the non-static field, method, or property 'JobComponentSystem.GetBufferFromEntity<Buff_TestChange>(bool)'
here is my system and the buffer in question
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Entities;
using Unity.Jobs;
using Unity.Burst;
[UpdateInGroup(typeof(Barrier_BurstDynamic))]
public class Sys_BurstDynamic_Test : JobComponentSystem
{
private struct Job : IJobForEachWithEntity<Tag_BusterDynamic_Test>
{
public void Execute (Entity ent, int index, ref Tag_BusterDynamic_Test tag)
{
var lookup = GetBufferFromEntity<Buff_TestChange>();
var buffer = lookup[ent];
}
}
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
Job job = new Job();
return job.Schedule(this, inputDeps);
}
}
and the buffer
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Entities;
[InternalBufferCapacity(10)]
public struct Buff_TestChange : IBufferElementData
{
public int id;
}
simple copy paste, I have no idea what i’m doing wrong O.o