I'm currently experimenting with Xna Content Pipeline extensions. Within that experimentation, I'm trying to load a file that contains another 'content item' that is in need of loading. For example:
public class CustomItem
{
public string Name;
public Texture2D Texture;
}
Now, in my content processor, I can create a new instance of 'CustomItem' and initialize the Name field, since it's simply a string. However, I can't load the texture file during content compilation (NOTE: The texture is just an example, ideally I'd like to be able to load any other content type).
What I'm looking for is something like:
// ... start class ...
public override CustomItem Process(SomeInputFormat input, ContentProcessorContext context)
{
return new CustomItem()
{
Name = input.ItemName,
Texture = context.LoadAsset<Texture2D>(input.ItemTexturePath) // I realise LoadAsset<T>() does not exist - it's an example of what would be ideal
};
}
// ... end class ...
Does anyone know if this is actually possible, and if so, how to go about it? I'd rather not go down the route of late loading the other content items if possible, or creating my own, custom content loading using binary readers and writers.