Why still need source file since got .xnb?

Hi,everyone!
I am a newer to MonoGame and I appreciate the effort that MonoGameTeam did.
I am using version 3.7.1 MGCB to generate .xnb file(.png/.jpg/.fbx/.obj as source file to .xnb).
But when I delete these source file and just keep .xnb file,errors “The source file ‘filepath/.obj’ does not exist!” show in VS2017.
When I use 3.5.1,there is no these problems.I just need to keep .xnb,and it could compatible with all platform.
How can I deal with this?
Appreciated!

Depending on your setup, the pipeline will get started every time you compile your game in VS. So it tries to detect changes and just re-compiles the changed assets, but it sees your asset is gone. Hence the error.

1 Like

Thanks for replying.
But how can I deal with it?
And there is another question, the MGCB can not compile my obj file to xnb,but in 3.5.1,there is no such problem.

Hi @ZhenNewBee Ni Hao Ma?

Welcome to the forums!

Have you tried converting the OBJ to say a .X and running it through MGCB?

Happy Coding!

EDIT

Oh and forgot to mention, the parser thing was changed around 3.6.

We just don’t delete the original asset-files.
Think of them as the source files for graphics/audio/video. They get ‘compiled’ when you compile your project and the pipeline tool will see to it that it doesn’t compile unnecessarily.
You wouldn’t delete your main.cs file after compiling either.

But when you’d like to do the MGCB-stuff manually, just set the build-action of your MGCB-entry in the content folder to ‘none’.

Example:
Here I have two pipelines in a single project. The first one, called ‘Content.mgcb’ runs automatically on build.
The second one doesn’t, so I have to trigger it manually (or copy the xnb files to the output folder, or whatever. Depends on your MGCB project settings for output-folder).

Properties of ‘Content.mgcb’:

Properties of ‘ContentAudio_Manual_3.5.1.mgcb’:

1 Like

Thanks for replying.
I’ve tried not only .x file,but also almost every model format.
It seems that only .fbx format works fine.
What’s more,all of the texture will be blank when I tranform .obj to .x.
Could you please offer me a link to let me know the changes of MGCB between 3.5.1 and 3.6?

Keep the texture in the same folder, double check the texture reference inside the file using a text editor.

Take a look here, unsure if it is current though:

http://www.monogame.net/documentation/?page=Using_The_Pipeline_Tool

This is the current 3.7.1 Change Log with history:

I think it is called OpenAssetImporter or AssImp

Thanks for your patient answer.
It still did not work.

Could you post a screenshot of your ‘content’ folder like I did above?
It should be empty except for a single MGCB file.
And that file should have that property set, like in my screenshot (buildaction = none).
Then the pipeline does nothing.

So the error should come from the game-runtime itself, trying to find an object-file and not finding it.
The error “The source file ‘filepath/.obj’ does not exist!” indicates that it searches a file without a name ?!
How’s that? Are you trying to load an empty name-string somewhere in your code?

Thanks for your warm-hearted answer.
@MrValentine @throbax
I have solved it by myself.
And I find 3 bugs in MGCB…
1.You need to use the “fbx importer” type if you want to import obj or you will get plenty of errors.
2.You need to remove the occupation of MGCB if you want to delete the source file and keep xnb file only.
3.You need to get your xnb file backed up when you want to rebuild model.For example,you got 2 model——“boy” and “girl”.You got the “boy.xnb” and just want to rebuild “girl.xnb”.But you have released the occupation of “boy” model.You will find all of your xnb file get deleted except “girl.xnb” if you click “rebuild” button.
@Tom @Jjagg
Thanks for the hard work of MonoGameTeam and I wish these bugs could be fixed.
It will be great if MGCB supports Blender.

1 Like

This is actually why I would have preferred the MGCB to be a standalone thing, completely removed from the templates, which is why if you follow my tutorial on it, I isolate the MGCB from my projects entirely.

Verbosity warning in advance :stuck_out_tongue: you have been informed :stuck_out_tongue:

And thanks for updating us here, I for some reason did not get a notification and the thread was not marked for me with your response, saw the notification in my junk folder in emails… anyway…

Code On!

Oh and yes, BLENDER totally!

Haha.
Actually I have read your tutorials before I raised up this question,and that is very friendly to a newer like me.
Thanks for your contribution.
Still,there are many painstaking work need to be done.

1 Like