I try to change the material of a gameobject in the editor by a EditorScript.
I use this code:
if(boolean == true)
{
var newMat = AssetDatabase.LoadAssetAtPath("Assets/blue.mat", typeof(Material));
if(newMat != null)
Debug.Log("Asset loaded");
else
Debug.Log("cant find asset");
target.renderer.material = newMat;
}
when i click the boolean in the EditorScript my debug log prints "Cant find asset".
↧