Skip to content

Fix World.TryGet(Entity, ComponentType) returning corrupted data - #320

Merged
genaray merged 1 commit into
genaray:masterfrom
armadavalor:fix/tryget-componenttype-304
Nov 20, 2026
Merged

genaray merged 1 commit into
genaray:masterfrom
armadavalor:fix/tryget-componenttype-304

Conversation

@armadavalor

Copy link
Copy Markdown
Contributor

The non-generic World.TryGet(Entity, ComponentType, out object?) reinterpreted the component array as object[]. For struct components the array is a typed struct array, so the read returned garbage (and crashed the test host with a fatal error for a Transform struct). World.Get(Entity, ComponentType) already goes through Array.GetValue; TryGet now does the same.

Added TryGetByComponentType to WorldTest, which aborted the test run before the change. The full Arch.Tests suite passes (143/143, net8.0).

Closes #304

@genaray
genaray merged commit a453a83 into genaray:master Nov 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

world.TryGet with ComponentType overload outs corrupted data

2 participants