Search Issue Tracker
Fixed in 5.3.7
Votes
0
Found in
5.3.5p4
Issue ID
812570
Regression
No
[IL2CPP] MarshalDirectiveException; marshaling of delegates as fields of a struct is not working
Issue with marshaling of delegates as fields of a struct when using IL2CPP - As noted by the user, there are no issues when using the Mono backend.
Originally reported at: https://community.unity.com/t5/Scripting/IL2CPP-MarshalDirectiveException/m-p/2648350#U2648350
Bug reported at the request of Joshua Peterson.
Steps to Reproduce
------------------------
1.Download the users reproduction project ('New Unity Project.zip').
2.Open in the editor and switch to a platform that supports IL2CPP.
3.Check that the scripting back-end is set to IL2CPP
4.Important: Tick 'Development Build' in the player settings (otherwise you won't see the exception in the TTY)
4.Select Build and Run
Result:
Running a build produced with '5.4.0f1' the following exception is spammed to the TTY:
--
Initializing client
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
SAMTest:Update()
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)
MarshalDirectiveException: Cannot marshal field 'gameWorldReservedCB' of type 'SAMCallbacks': Reference type field marshalin
g is not supported.
at SAMTest.samInitialize (IntPtr inParams, SAMCallbacks& callbacks) [0x00000] in <filename unknown>:0
at SAMTest.Update () [0x00000] in <filename unknown>:0
(Filename: currently not available on il2cpp Line: -1)
--
Reproduced in:
5.4.0f1 (c6df7519ab13)
5.3.5p8 (4ff20829e874)
5.3.5p4 (f55402cb6571)
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Trojan_Rn
Jul 28, 2016 05:28
when i convert byte[] to a struct
get a MARSHALDIRECTIVEEXCEPTION unity version 5.3.5f1