This series Article They are all articles found on msdn. Add some learning notes. XNa game studio 3.0 adding game assets to your game
Demonstrates how to add a texture asset to your game. the same procedure can also be applied to model and sound assets. it is assumed that an existing windows, Xbox 360, or Zune game project is loaded in xNa game studio.
There are two ways to add a texture asset to your game, either by adding the asset file or by adding a link to the asset.
To create a game, we may first need some materials, which are about how to add materials. There are two ways to add materials:
1. Add a clip file
2. Add a clip link
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. Note: adding a clip file is different from adding a clip link. The former copies the clip content to the project, and the latter only maintains a path pointing to the clip. |
Adding the texture asset to the game 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 onlyOneDeveloper in one project and isNotExpected to be changed.
If a clip does not need to be changed and is only for a developer, you can add the clip file directly to the project.
To add the texture asset to the game project
From the Solution Explorer window, right-clickContentNode, clickAdd, And then clickExisting item.
Navigate to the location of the texture, and select it.
For this example, the asset is called bw.nebula01.tga.
ClickAddButton.
This creates a copy of the selected asset in your project.
Save the solution.
Adding the texture asset as a link to the game 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 game project
From the Solution Explorer window, right-clickContentNode, clickAdd, And then clickExisting item.
Navigate to the location of the texture, and select it.
For this example, the asset is called bw.nebula01.tga.
Click the small arrow to the right ofAddButton, and then clickAdd as Link.
This creates a reference to the selected asset (and not a copy) in your project.
Save the solution.
When adding a file or a file link is different, you can select the Add button action.
Verifying the content importer
You shoshould use this procedure each time you add a game asset. This ensures that the asset will be correctly recognized and processed by the content pipeline.
Confirm content pipeline every time you add a clip, that is, confirm that the clip can be loaded correctly and effectively by xNa.
To verify the game asset will use the correct content importer
After you add the asset to the solution, openPropertiesWindow to verify that you specified the correct importer and processor.
To verify, right-click on the file in Solution Explorer, and then, from the context menu, clickProperties.
For this example,Content importerIs texture-xNa framework andContent ProcessorIs texture-xNa framework.
For more information onPropertiesWindow of a game asset, see game asset properties.
Save the solution.
Main check: Content importer and content Processor