I don't know if it is a C# thing or a mono or unity thing but I've found out in multiple Unity games so far that Structures for example Vector3 seem to always work kind of weird.
I've actually had it once where a function that whould take a Structure as its argument didn't just pass one argument in Assembly, it actually passed each field in the structure individually.
So when I see a function that takes/returns a structure I always try to find out what the function does with it Parameters to find out how it handles it. Using the Transform:get_position function as an example, you can see down below what it does with the first parameter and see what I mean.
It first of makes eax/rax 0 and then writes rax to [rcx] clearing the first 8 bytes of the first parameter and then writes eax to [rcx+8] clearing another 4 bytes in the first argument.
So from that you can already guess that the function passes the returned Vector3 as the first argument and that it has to be a memory location that can store 3 Floats.
I haven't found a easier method to finding out how to handle functions that return or take structres, other than looking a the function itself unfortunately..
All times are GMT - 6 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum