- Home /
The question is answered, right answer was accepted
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? :)
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.
Answer by GodlikeAurora · Oct 06, 2018 at 04:41 PM
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.
Follow this Question
Related Questions
How can I load texture files that are outside of my project folders? 1 Answer
Multiple Textures and their impact on resources 2 Answers
Unable to free resources from memory 0 Answers
Does reference to Texture count on RAM usage of device? 0 Answers
Is it safe to add reference to files in Resources folder? 1 Answer