4

Normally, when loading content using XNA's Content Pipeline, the compiled .xnb files are accessed using an assigned "Asset Name" that can be defined in the Visual Studio GUI. By default, this name is the same as the content's filename sans extension. As a result, you cannot normally load two files that have names differing only by extension as the generated .xnb files would have conflicting names. If you manually change the asset name of one of these files, the generated .xnb files no longer conflict.

For a level loading system I am writing, I was hoping to have the setup of loading the texture data and collision data from two separate files with the same name (level1.png and level1.col) where the collision data is simply a text file. I have written a custom content processor to load the collision data using the Content Pipeline.

It seems it is not possible to modify the asset name directly in normal game code, but I have been unable to determine if it can be done from within a custom content processor. Is this possible? Or must I modify all the asset names by hand in order to do this?

I would ask this on the App Hub forums, but I am having a rather difficult time trying to log into that site without registering (and giving credit card information) for the developer package. I'm currently using XNA for a Windows platform game, and have no interest in developing for the X360 at this time.

Shaun Hamman
  • 2,287
  • 4
  • 21
  • 33
  • I suspect you can't, but I'm not sure. However: it would seem more pragmatic to simply give them different file and asset names (perhaps specify the texture name in the `.col` file?) rather than have to write tricky content pipeline code. – Andrew Russell Jun 19 '11 at 02:33
  • It would be rather simple to just output different file names. I was more hoping to get this working just to make having multiple files look cleaner on the filesystem. It was also a chance to learn more about what you can do with the pipeline. Oh well. – Shaun Hamman Jun 19 '11 at 11:28

1 Answers1

1

In the interest of providing what I found, it seems that it is not possible to change the asset names from within a custom content processor either.

Shaun Hamman
  • 2,287
  • 4
  • 21
  • 33