I know this must be plainly simple, but still it eludes me:
I want to create a mesh and/or material (in an Editor script), and I want to assign a mesh from my assets. Not necessarily in Resources folder mind you, just some random asset.
something like:
gameObject.GetComponent(MeshFilter).sharedMesh = ?LoadAsset? (“big_gun_mesh”);
Is this possible?
You can use the AssetDatabase class for things like this (you most likely want the LoadAssetAtPath function).
I got something working (I should take up dentistry, cuz this was like pulling teeth):
GameObject newGO= (GameObject)EditorUtility.InstantiatePrefab(AssetDatabase.LoadMainAssetAtPath (modelPath+“/”+oldTransform.name+“.dae”));
Assumes a path and file type. InstaniatePrefab will instantiate a model, despite its name.
I’d still rather not have to use a file path if possible, but at least this gets me moving again.