public static Texture LoadTexture(TextureData texData) { if (texData.tex == null) { if (!File.Exists("EZ CSP/" + texData.path)) { if (!Directory.Exists("Assets/Editor Default Resources/" + EZ_EditorAssets.assetName)) { Directory.CreateDirectory("Assets/Editor Default Resources/" + EZ_EditorAssets.assetName); } AssetDatabase.Refresh(); FileInfo fInfo = new FileInfo("Assets/" + EZ_EditorAssets.assetName + "/Editor/Texture Resources/" + texData.path); fInfo.CopyTo("Assets/Editor Default Resources/" + EZ_EditorAssets.assetName + "/" + texData.path, true); AssetDatabase.Refresh(); texData.tex = EditorGUIUtility.LoadRequired(EZ_EditorAssets.assetName + "/" + texData.path) as Texture; } } return texData.tex; }
public static void DrawTexture(TextureData texData) { DrawTexture(LoadTexture(texData)); }