Netcode Bootstrap

This commit is contained in:
Luis Gonzalez
2026-05-31 14:27:52 -07:00
parent 99d8d2d2a9
commit 7fa77ce821
1813 changed files with 2921554 additions and 84 deletions
@@ -0,0 +1,23 @@
using Unity.Entities;
/////////////////////////////////////////////////////////////////////////////////
namespace Rukhanka.Toolbox
{
public static class EntityTools
{
public static unsafe bool TryGetChunkComponentData<T>(ArchetypeChunk chunk, Entity otherChunkEntity, ref ComponentTypeHandle<T> typeHandle, out T outChunkData) where T : unmanaged, IComponentData
{
outChunkData = default;
var otherChunkIndex = chunk.m_EntityComponentStore->GetChunk(otherChunkEntity);
var otherChunk = new ArchetypeChunk(otherChunkIndex, chunk.m_EntityComponentStore);
if (!otherChunk.HasChunkComponent<T>())
{
return false;
}
outChunkData = otherChunk.GetChunkComponentData(ref typeHandle);
return true;
}
}
}