/// <summary>Loads the image data from a file into a new Texture.</summary> public static bool TryReadImageFile(string filePath, out Texture2D texture) { Debug.Assert(!String.IsNullOrEmpty(filePath)); if (File.Exists(filePath)) { byte[] imageData; bool readSuccessful = IOUtilities.TryLoadBinaryFile(filePath, out imageData); if (readSuccessful && imageData != null && imageData.Length > 0) { texture = new Texture2D(0, 0); texture.LoadImage(imageData); return(true); } } texture = null; return(false); }