0

Unable to Create New Material Mapping

pfry 3 years ago in CADLink updated 3 years ago 1

So I can import a 3MF file created with SolidWorks; however, the result import in Unity appears as a bright violet version of the object. I also just tried manually importing the toy car sample 3MF and the colors were transferred properly. This leads me to believe I need to define a material mapping which I am unable to do within the CADLNK Unity asset features.

I am trying to follow the instructions here https://game4automation.com/documentation/current/cadlink.html#3MF-Import-Settings and see if designing my own material mapping will resolve the issue. However, when I click on the "Create New Material Mapping" button I get the following error

IndexOutOfRangeException: Index was outside the bounds of the array.
game4automation.CADLink.CreateAsset[T] () (at Assets/game4automation/CADLink/private/CADLink.cs:750)
game4automation.CADLink.CreateMeaterialMapping () (at Assets/game4automation/CADLink/private/CADLink.cs:86)

The line of problem is 

var find = AssetDatabase.FindAssets("StandardMaterialMapping t:ScriptableObject");

string path = AssetDatabase.GUIDToAssetPath(find[0]);

I'm guessing the issue is that when I import the CADLINK asset the "StandardMaterialMapping" is not included. I am struggling to find any further documents outlining the details of what a material map looks like. Is there no default option which just takes the color defined in the 3MF file and uses that to create the unity material? I thought that would be the default and was the main appeal of asset. 


Please let me know if there is something I am doing incorrectly, because I'm looking through all the available documentation and other forum responses to try and figure out what is going on.

So I found out the 3MF files I was getting were not being saved with the options to preserve the materials and color. So now the import of the files is preserving the color of the original files. I would say this is essentially resolved, but it would still be good to investigate the error when trying to create a material mapping.