✅ unsafe code problems

What error even is this? When I click on it google doesn't give info lol. I initially wanted to used a fixed buffer, but apparently fixed buffers can't take a structs.
No description
9 Replies
ElectricTortoise
ElectricTortoiseOP4d ago
i also tried
ScoredMove* ScoredMoves = stackalloc ScoredMoves[Length]
ScoredMove* ScoredMoves = stackalloc ScoredMoves[Length]
but that means I can't make that it a field in the struct
Angius
Angius4d ago
Man, you're doing some wacky shit here lol, is it just to learn unsafe C#? #allow-unsafe-blocks might be of some help, then
ElectricTortoise
ElectricTortoiseOP4d ago
yes and no apparently regular C# code is slow so i need unsafe code for speed
Angius
Angius4d ago
Did you test that it's slow?
ElectricTortoise
ElectricTortoiseOP4d ago
yes not this bit specifically, but with other bits of the code when i switched from array[] to fixed array[] my code sped up a ton
Angius
Angius4d ago
I'd link this thread in #allow-unsafe-blocks and add a short explanation, then They'll either tell you how to get this code working, or they'll point out how you could've changed your original world without unsafe
ElectricTortoise
ElectricTortoiseOP4d ago
should i just repost it there myself
Angius
Angius4d ago
ye
ElectricTortoise
ElectricTortoiseOP4d ago
i should show more of the code, i might be able to get away with not using unsafe now that i think about it

Did you find this page helpful?