0
\$\begingroup\$

I have quite a lot of custom content pipeline components, and I was just wondering if under the hood XNA knows about these things when doing its magic...

Here is my scenario.

I have animation objects which basically contain 2d animation frames and timings etc, which can be loaded as self contained objects or can be embedded within other object. Now I was expecting that my CustomObjectAWriter could contain an instance to AnimationObjectAWriter and internally just call through to that to write out each animation object, i.e:

<SomeCustomObjectA>
    <SomeCustomElementA>
        ...
    </SomeCustomElementA>
    <SomeCustomElementB>
        ...
        <AnimationObjectA>
            ...
        </AnimationObjectA>
    </SomeCustomElementB>
</SomeCustomObjectA>

However as AnimationObjectAWriter has its Write method protected I am unable to access it, however I was wondering if WriteObject will know of the AnimationObjectAWriter so if I did WriteObject<AnimationObjectA>(animationObjectAInstance) would this work?

\$\endgroup\$
1
\$\begingroup\$

Yes that will work, although if it's just simple XML->objects you probably don't need custom writers/readers at all.

See: http://blogs.msdn.com/b/shawnhar/archive/2009/03/25/automatic-xnb-serialization-in-xna-game-studio-3-1.aspx

See also: http://www.shawnhargreaves.com/blogindex.html#contentpipeline

\$\endgroup\$
  • \$\begingroup\$ it is xml but it is not in the xna content format as it is used for non XNA frameworks too, and it is not a simple 1-1 mapping like XNA prefers, but thanks for the answer. \$\endgroup\$ – Grofit Feb 5 '12 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.