compile xnbs at runtime?

Hi guys,

I’m sure there is already a lot of stuff written about that, but somehow I didn’t find anything useful at all :frowning:

If i had an editor -like environment I want to be able to load fbx and texture files in runtime. I understand the models have to be converted into .xnbs first for further processing. How would I go about that? Are there any sample implementations?

Thank you :slight_smile:

1 Like

You can compile stuff to .xnb from Windows/Linux/Mac by launching mgcb.exe with appropriate arguments http://www.monogame.net/documentation/?page=MGCB, in other words for an editor you could just compile the .fbx to .xnb in the temp directory, and load the result from there.

Instead of running mgcb.exe, you can also directly link your editor against MonoGame.Framework.Content.Pipeline.dll, create a PipelineManager and call PipelineManager.BuildContent.

2 Likes

Just gonna mention that using MGCB.exe you could create a cache so you don’t have to rebuild all the content every time you start your editor.

1 Like