|
I am attempting to use the XML serializer in System.XML.Serialization. My XML file deserializes fine on the mac, and fails on the iPhone with the following: Attempting to JIT compile method '(wrapper delegate-invoke) System.Reflection.MonoProperty/Getter`2:invoke_string_this__fx_common_color_or_texture_typeColor (goBuild.goBIM.fx_common_color_or_texture_typeColor)' while running with --aot-only. Apparently it's trying to JIT compile methods in my XML, and the only [suggested work-around][1] from Mono is to call each method that I will eventually need prior to deserialization in order to force inclusion in AOT. This is unreasonable for a number of reasons, not the least of which is that I don't know exactly what methods I'll need. Does anyone know how to get this to work? I'm using Unity Pro iPhone with stripping disabled targeting .NET 2.1.
(comments are locked)
|
|
Same here, would appreciate any news on this subject
(comments are locked)
|
|
EDIT: Hey all, I found a way to deserialize an xml (for reading) while still keeping the files organized in unity without going through any odd steps Here's an example of how it worked in the editor (minus all debugging and error checking): And here's my example (minus all debugging and error checking) of how it works on the iPad build: In the latter example, I use a basic unity Resources.Load call to get the xml file as a TextAsset so that it may be used as a block of text (string) rather than using a file path. I then use that text to initialize an object (XmlTextReader) that can be (de)serialized. I'm not too sure if I used too many steps or if this is the only/right way to do this, but I do know it works. Feel free to comment with any questions/flaws you'd like to point out. Hope I helped! :) Original Post: Hey there! I am having the exact same problem. Using the Deserialize function I Use -> Application.dataPath + "/Resources/_XML/sfx.xml" <- as my file path. But this will not work on the iOS device the build is intended for. I have found a way to manually place a folder with my .xml file directly into the build folder so that I can access it directly. This is still a huge pain in my behind as far as updates and other co-workers possibly deleting or even use the file and my system. I guess in summary, I would like to know how to use the same style of loading that worked with the 'in editor' version that still works on iOS. It doesn't have to be the exact same code for both cases, just something that would allows us to keep the files within the Unity Editor and easily accessible by anyone with our Unity build. Thanks for any help in advanced! :)
Oct 11 '12 at 05:04 PM
SSauerGFG
(comments are locked)
|
|
for this one you need XmlSerializer serializer = new XmlSerializer(typeof(YourClass)); YourClass yourClassVariable = (YourClass)serializer.Deserialize(thestreamofyourfile); with this the varialbe "yourClassVariable" will have all the xml info there
(comments are locked)
|
|
Hi were you able to solve this? I am getting the same problem, involving a 3rd party Serialization library (protobuf-net)
(comments are locked)
|
