How to: Add Game Assets to a Content Project
This topic demonstrates how to add an art asset to the game content project, using a texture asset as the example. The same procedure also can be applied to model and sound assets.
It is assumed that an existing Xbox 360, Windows, or Windows Phone game project is loaded in XNA Game Studio.
There are two ways to add a game asset to your game, either by adding the asset file or by adding a link to the asset.
Tip
Adding an existing asset to your project is quite different from adding an existing item as a link to your project. The first method creats a copy of the asset file and adds the copy to your project. Adding an asset as a link stores only the path to the asset file.
Adding the Texture Asset to the Content Project
When you add a game asset (not as a link), XNA Game Studio makes a copy of the asset file and adds the copy to the content project. For this reason, adding a game asset in this manner may be most appropriate when the asset is used by only one developer in one project and is not expected to be changed.
To add the texture asset to the content project
In Solution Explorer, right-click Content, click Add, and then click Existing Item.
Navigate to the location of the texture, and select it.
For this example, the asset is called B1_nebula01.tga.
Click the Add button.
This creates a copy of the selected asset in your project.
Save the solution.
Adding the Texture Asset as a Link to the Content Project
Adding an asset as a link is useful if the referenced asset depends on additional external assets. It ensures that the solution always uses the latest version. For this reason, adding a game asset as a link may be most appropriate when the asset is shared with other people or other game projects, or is likely to be changed.
To add the texture asset as a link to the content project
In Solution Explorer, right-click Content, click Add, and then click Existing Item.
Navigate to the location of the texture, and select it.
For this example, the asset is called B1_nebula01.tga.
Click the small arrow to the right of the Add button, and then click Add as Link.
This creates a reference to the selected asset (and not a copy) in your project.
Save the solution.
Verifying the Content Importer
You should use this procedure each time you add a game asset. This ensures that the asset is correctly recognized and processed by the Content Pipeline.
To verify the game asset will use the correct content importer
After you add the asset to the solution, open the Properties window to verify that you specified the correct importer and processor.
To verify, in Solution Explorer right-click the file, and then click Properties.
For this example, the Content Importer is Texture - XNA Framework and the Content Processor is Texture - XNA Framework.
Save the solution.
For more information about the Properties window of a game asset, see Game Asset Properties.