FBX export does not include Textures when assigning _BaseColorMap during runtime

Trying to applying a texture dynamically during runtime to _BaseColorMap and exporting GameObject as FBX afterwards. Texture correctly applied to the shader and is also visible in Game View. But Texture is not assigned to _BaseColorMap in the exported FBX.

I manually applied a texture before runtime to _BaseColorMap in Unity Editor and exporting FBX which works as expected.

Not sure what’s the difference here or why it is not included in the FBX when i assign it during runtime.

Example Code

// Init chip GameObject based on Prefab
chip = Instantiate(chipPrefab, new Vector3(0, 0, 0), Quaternion.identity);

// Assign material to chip Mesh Renderer
ringOutsideRenderer = chip.transform.Find("ring_outside").GetComponent<MeshRenderer>();
ringOutsideRenderer.material = ringOutsideMaterial;

// Set texture on Mesh Renderer Material
ringOutsideRenderer.material.SetTexture("_BaseColorMap", ringTexture);

// Export chip as FBX
string filePath = Path.Combine(Application.dataPath, exportFileBasename + ".fbx");
Object[] objects = new Object[1];
objects[0] = chip;
ModelExporter.ExportObjects(filePath, objects);
Debug.Log("Export: " + exportFileBasename + ".fbx");

// Problem: FBX does not include textures applied
// Research: Applying a texture to _BaseColorMap in Unity Editor and exporting FBX, includes texture

Code screenshots are not useful.

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly

This might be related to your problem:

Thanks for your response. I will give it a try. Added code tags too.