In xna i was able to use the xml importer with no problems but now there is a problem. Can someone point me in the right direction? I have already converted ProjectMercury over to mono and I am able to run the editor using mono and loading in and exporting the particle xmls. But when I try and load it into another game using the mgcb it keeps saying that it doesnt know the type. I have linked the references and unlinked them idk how many times and wrote a basic importer and processor that gives me the same error.
What does monogome like and not like about this xml? I made a level editor as well that uses serialization and my own content importer and exporter and processor and that compiles just fine after converting it to mono. Any help would be awesome.
The content pipeline tool has its own References that need to be set. When you say you linked the references I assume you meant in the project.
Try opening the pipeline tool, click on Content at the top. Under properties will be “References,” which you can use to select the proper DLL for the content pipeline tool to use.
In the MonoGame Pipeline Tool, after importing the old xml effects files that worked previously with XNA/Project Mercury, I get the following error for each effect when I try to build:
“Microsoft.Xna.Framework.Content.Pipeline.InvalidContentException: Could not resolve type ‘ProjectMercury.ParticleEffect’.”
I have added the old dlls (ProjectMercury.dll, ProjectMercury.Content.dll) as references to the Content object in the pipeline tool. The xml effect files begin as follows:
Update:
I’ve added a reference to Monogame.Extended.Particles, and now the error message has changed:
System.Exception: Couldn’t create object of type ParticleEffect: No parameterless constructor defined for this object. —> System.MissingMethodException: No parameterless constructor defined for this object.
How does one correctly import legacy Mercury Particle Engine xml particle effects?
Thats because a default serialize requires the class you are serializing to have a default constructor. Eg. Myclass::Myclass(); The monogame extended particles doesnt allow for xml serialization.
Ok so I have made some progress on this without having to write my own processor and importer. But it seems that inside monogames ReflectiveSerializer.cs inside the Deserialize function it fails when trying to move to Element Enabled. So !input.MoveToElement(info.Attribute.ElementName)). Second thought could it be that the monogame xml is expecting everything to be in order from the class? Because it looks like the elementinfo is getting taken straight out of the position in the class but in the xml document its not in that order. hmmmm
Ok last update and I think everyone will be happy with it now lol. I have fixed the problem! Here is the project with the updated ProjectMercury editor and the content importer and processor. In your ContentPipline tool just point to the SynapseContentImporter.
I’m really interested to try this out as I’ve had similar problems with importing ProjectMercury .xml files - however I’m struggling to follow your instructions of ‘point to SynapseContentImporter’.
I can’t find any Synapse dll files or any mention of Synapse in the code.
I’ve managed to build your code successfully and have tried a variety of dlls in the pipeline tool but no luck so far.
Would you mind sharing the SynapseContentImporter file so it’s basically fool proof for me
Ah Well turns out I had guessed correctly which dll to use but still having no joy.
I’ve tried importing the EffectLibrary xml files that come with the original ProjectMercury. e.g. BasicExplosion.xml.
I’m adding them in the Pipeline Tool. I’ve referenced the dll and I’ve set the xml file to use the MercuryImporter. Weirdly it gets a tick in the Pipeline Tool but it fails with an error: The Xml element Name is required!
I’ve tried your test version from the top of this page. That fails with: The Xml element Enabled is required!
Is this related the the ContentImporter ordering problem that seems to be a problem across many Monogame Content files or can you spot something more obvious I’m missing?
Ok so for me I have referenced ProjectMercuryContentImporter.dll, ProjectMercury.dll, and ProjectMercury.ContentPipeline.dll And to be safe I included ProjectMercury inside of the sln project.
Thanks - that seems to be an improvement. The Content Pipeline is happy with all the dlls added. Although, I was pretty sure I tried that combination right at the beginning but nevermind
So I can load in your test version now - but I’m still having no luck with the included EffectLibrary .xml files. Did you have any joy with those? I get a host of different missing elements xml errors - so I’ve be re-jigging the xml to make it a bit happier - but haven’t managed yet.
Looks like I’m going to have to compile the MGCB from source and dig a bit deeper.