I am following a book trying to learn how to use Monogame/xna and I’ve hit a major obstacle: Spritefonts.
It looks like monogame has it built in, via content pipeline, but I cannot find it anywhere. I checked some other threads about it and they said there is a
/tools/ folder in the
/MSBuild/Monogame/ folder. I could not find said folder.
I’m using VS 2013 Community Edition and Monogame 3.2. I used the installer available in the downloads section to install monogame.
Make sure you are using the Develpment Build of 3.2 and not the one listed under “Releases”.
Just double click on Content.mgcb in Content folder in the new project.
I’m not sure if this is standard for all MonoGame users, but I’ve been able to find the Pipeline tool in:
C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools
Also, after you’ve found the Pipeline tool, this is a good resource describing how to use it:
Am I understanding the tool wrong?
Ive followed that page you linked, but I am not getting any XNB files. Ive added an fbx and png file to the tool, built it successfully, but I don’t get anything in my output file.
I would try the following:
- Add the FBX/PNG files in the Pipeline tool (which you’ve already done).
- Build or rebuild the project. Make sure that the selected node in the project tree is the root node for the project, so that the entire project is built.
- Navigate to the location of the FBX and PNG files in your filesystem, and see if the XNB files are located there. If so, then those XNB files need to be copied to your MonoGame project’s output folder (in Visual Studio it should be bin/Windows/Debug/Content I think).
Also, the “Add With Wildcard” section on the linked page should cause the XNB files to get copied to the output directory automatically when your project is built.
Does the above work?
Oh the XNB files are where the original files are located.
Is there anyway for them to go to the output folder I specified or will I just have to make a separate folder for my content?
I’ve been doing this and it seems to work so far, but I’m not sure if it’s the ideal/correct way of doing things.
- In Visual Studio, under the startup project for your game, make a folder called “Content”.
- Add folders to mirror the structure of your content project in the Pipeline tool, if there are folders there.
- In VS, do Add->Existing item under the Content folder, and select the XNB files that were generated when the Pipeline tool ran.
- Select the XNB files in Visual Studio, go to the “Properties” window, set the “Build Action” to “Content”, and “Copy to Output Directory” to “Copy if newer”. This should ensure that the XNBs get copied to the output directory when they’re updated.
If someone knows a better/simpler way of doing this, I’d be interested as well.
You can look at how we make things work in the new MonoGame VS templates. They use a .targets file to trigger the content build and add the output XNBs to the game build.
Nice, this looks much simpler. Looks like I started my game with an earlier version of MG and updated MG later without updating my project appropriately. Thanks for the tip.