hello, I’m using xml to store various information from my games, including the quiz system. The problem that only works in the editor, but in the build it doesn’t read any data. How to solve this problem?
Find out why. Look at the logs. If it is just a null reference, fix it.
If it is a missing constructor, then make sure that 100% of the objects you might deserialize into did not get any parts of themselves stripped.
Also, you might want to consider just storing your data in ScriptableObjects to avoid XML.
“So lets say you have a problem. You decide to use XML. Now you have two problems.” - unknown author
I decided to transform the xml into json, I tried an automatic converter but it didn’t work, can you tell me the correct syntax for an array of objects? Is it possible to do just using JsonUtility or do you have to use another json plugin?
example:
<?xml version="1.0"?>
<ArrayOfTechnicalObject xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<TechnicalObject>
<id>0</id>
<title>title 1</title>
<description> desc 1 </description>
</TechnicalObject>
<TechnicalObject>
<id>1</id>
<title>title 2</title>
<description> desc 2 </description>
</TechnicalObject>
Be sure to leverage sites like:
Problems with Unity “tiny lite” built-in JSON:
In general I highly suggest staying away from Unity’s JSON “tiny lite” package. It’s really not very capable at all and will silently fail on very common data structures, such as Dictionaries and Hashes and ALL properties.
Instead grab Newtonsoft JSON .NET off the asset store for free, or else install it from the Unity Package Manager (Window → Package Manager).