I know how to access object’s material list:
obj.GetComponent<MeshRenderer>().material = ???
However, what should go in ??? The material already exists in my Assets folder as .mat file. I run this script in editor NOT at runtime. The result should be equivalent to manually (with mouse clicks) assigning material in Inspector->MeshRenderer. Resources.Load
is the weirdest function I have seen so far and I don’t want to use it. AssetDatabase.LoadAssetAtPath
doesn’t work.