Search Issue Tracker
Fixed in 4.6.5
Votes
2
Found in
4.6.2p1
Issue ID
670888
Regression
No
[IL2CPP] Marshal.SizeOf dosen't work with types which have an explicitly defined size
To Reproduce:
1. Deploy the attached project with Il2CPP.
2. Notice the, error:
ArgumentException: Type 'CustomType' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed.
at System.Runtime.InteropServices.Marshal.SizeOf (System.Type t) [0x00000] in <filename unknown>:0
at Test..cctor () [0x00000] in <filename unknown>:0
(works fine with mono).
3. Only happens with types which have a StructLayout attribute.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Mobile] Developer Console does not appear when an error is thrown
- [HDRP] Game view renders artifacts when Camera's Component "Post Anti-aliasing" is set to "TAA" and Dynamic Resolution's "Forced Screen Percentage" is changed
- A deactivated Prefab's name color becomes white when a GameObject in the scene is deactivated
- The Game view becomes blank when using Frame Debugger with MSAA and Texture binding enabled in Play Mode
- NullReferenceException is thrown when changing the Inspector preview selection
hectorLSZ
Apr 04, 2015 15:13
I have met the same exception also when I deploy my project with IL2CPP.
My unity is 4.6.3.p4