Make reference to the project texture file in the material field

Hi, I have a question. I need to add texture from project files in the material main texture field in editor script.

It is simple, but I need to make reference to the project file, but all what I tried only creates insance of texture, which stored in memory, and on next Unity run material field is always empty. I understand, how it works, but can’t understand, how to add reference to project file, not to created instance.

Any ideas? :slight_smile:

I tried loading texture file by Resoures.Load and File.ReadAllBytes, but in any case it creates an instance of texture, not making reference. So I think, it should be done in other way.

Solved with AssetDatabase.LoadAssetAtPath. By some reason Resources.Loaded given me instance of texture, not reference to original file. AssetDatabase.LoadAssetAtPath has no this problem.