Skip to main content
added 25 characters in body
Source Link

I've got it! An extremely simplified example:

Loaded each Texture2D in custom ContentProcessor like this...

// Create external ref to texture source file (.bmp, .png, etc)
ExternalReference<Texture2DContent> tex_ref = new ExternalReference<Texture2DContent>(path_to_image_file);

// Build & Load texture
Texture2DContent texture_content = context.BuildAndLoadAsset<Texture2DContent, Texture2DContent>(tex_ref, "TextureProcessor");

Then serialized Texture2DContent in custom ContentTypeWriter like this...

// Write as Texture2DContent
output.WriteObject(texture_content);

Conversion happens during de-serialization, in custom ContentTypeReader...

// But read back as Texture2D
Texture2D texture = input.ReadObject<Texture2D>();

I've got it! An extremely simplified example:

Loaded each Texture2D in custom ContentProcessor like this...

// Create external ref to texture file
ExternalReference<Texture2DContent> tex_ref = new ExternalReference<Texture2DContent>(path_to_image_file);

// Build & Load texture
Texture2DContent texture_content = context.BuildAndLoadAsset<Texture2DContent, Texture2DContent>(tex_ref, "TextureProcessor");

Then serialized Texture2DContent in custom ContentTypeWriter like this...

// Write as Texture2DContent
output.WriteObject(texture_content);

Conversion happens during de-serialization, in custom ContentTypeReader...

// But read back as Texture2D
Texture2D texture = input.ReadObject<Texture2D>();

I've got it! An extremely simplified example:

Loaded each Texture2D in custom ContentProcessor like this...

// Create external ref to texture source file (.bmp, .png, etc)
ExternalReference<Texture2DContent> tex_ref = new ExternalReference<Texture2DContent>(path_to_image_file);

// Build & Load texture
Texture2DContent texture_content = context.BuildAndLoadAsset<Texture2DContent, Texture2DContent>(tex_ref, "TextureProcessor");

Then serialized Texture2DContent in custom ContentTypeWriter like this...

// Write as Texture2DContent
output.WriteObject(texture_content);

Conversion happens during de-serialization, in custom ContentTypeReader...

// But read back as Texture2D
Texture2D texture = input.ReadObject<Texture2D>();
Source Link

I've got it! An extremely simplified example:

Loaded each Texture2D in custom ContentProcessor like this...

// Create external ref to texture file
ExternalReference<Texture2DContent> tex_ref = new ExternalReference<Texture2DContent>(path_to_image_file);

// Build & Load texture
Texture2DContent texture_content = context.BuildAndLoadAsset<Texture2DContent, Texture2DContent>(tex_ref, "TextureProcessor");

Then serialized Texture2DContent in custom ContentTypeWriter like this...

// Write as Texture2DContent
output.WriteObject(texture_content);

Conversion happens during de-serialization, in custom ContentTypeReader...

// But read back as Texture2D
Texture2D texture = input.ReadObject<Texture2D>();