xna - IntermediateSerializer returning empty arrays -
xna - IntermediateSerializer returning empty arrays -
i developing custom editor xna game objects can create graphical editor , unity rip-off style game builder (which going surprisingly well) having issues intermediate serializer acting unusual in relation of entity component objects.
i wrote custom deserializer keyboardcomponent follows
protected override keyboardcomponent deserialize(intermediatereader input, contentserializerattribute format, keyboardcomponent existinginstance) { keyboardcomponent toreturn = new keyboardcomponent(); input.xml.readstartelement("active"); toreturn.active = input.xml.readstring() == "true" ? true : false; input.xml.readendelement(); input.xml.readtofollowing("keys"); int count = int.parse(input.xml.getattribute("count")); input.xml.readstartelement("keys"); system.diagnostics.debugger.launch(); (int = 0; < count; i++) { input.xml.readtofollowing("key"); string key = input.xml.getattribute("name"); input.xml.readstartelement("key"); keys value = (keys) enum.parse(typeof(keys), input.xml.readstring()); input.xml.readendelement(); toreturn.addinput(key, value); } system.diagnostics.debugger.break(); input.xml.readendelement(); homecoming toreturn; }
the corresponding serializer has made xml
<asset type="framework:input.keyboardcomponent"> <active>true</active> <keys count="4"> <key name="up">w</key> <key name="down">s</key> <key name="left">a</key> <key name="right">d</key> </keys> </asset>
when load in entity using object through content pipeline new keyboardcomponent empty list if debug through content build process keyboardcomponent can see items beingness added returned item turned xnb object.
the returned items added collection in entity other components read correctly none contain arrays or lists assuming issue although may wrong.
it necessary utilize intermediate serializer graphical editor programme work help why loading object content pipeline clearing arrays helpful
xna serializer
Comments
Post a Comment