Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6822

[Question] Loading list of a class in a XML using ContentPipeline

$
0
0

@Antonio_Marco_da_Sil wrote:

So, i'm trying to load a XML file from the Content Pipeline, the xml is the following:

<?xml version="1.0" encoding="utf-8"?>
    <XnaContent>
      <Asset Type="GoblinData.Coloration[]">
        <Item>
          <name>Verde Claro</name>
          <color>199 234 70</color>
          <combat>2</combat>
          <knowledge>2</knowledge>
          <dextirity>1</dextirity>
          <luck>1</luck>
        </Item>
        <Item>
          <name>Verde</name>
          <color>0 255 70</color>
          <combat>2</combat>
          <knowledge>2</knowledge>
          <dextirity>1</dextirity>
          <luck>1</luck>
        </Item>
      </Asset>
    </XnaContent>

and heres the class:

namespace GoblinData
{
    public class Coloration
    {
        public int id;
        public string name = null;
        public int[] color = { 0, 0, 0 };
        public int combat = 0;
        public int knowledge = 0;
        public int dextirity = 0;
        public int luck = 0;
    }
}

I maded a library with the contents of the file, and the ContentPipeline loaded with no problem.

But when i run Content.Load<GoblinData.Coloration[]>("Xml\\Colorations"); the following error show up:

Microsoft.Xna.Framework.Content.ContentLoadException: 'Incorrect type reader index found!'

Anyone know how to load a list of a class in Monogame from the content pipeline?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6822

Trending Articles