Skip to content

Commit

Permalink
Added a method to load PNGs
Browse files Browse the repository at this point in the history
  • Loading branch information
solidDoWant authored and solidDoWant committed Jan 12, 2017
1 parent 60efe23 commit ef18b88
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Utils.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
using Planetbase;
using System.IO;
using UnityEngine;

namespace PlanetbaseFramework
{
class Utils
{
public static Texture2D LoadPNG(string filePath)
{

Texture2D tex = null;
byte[] fileData;

if (File.Exists(filePath))
{
fileData = File.ReadAllBytes(filePath);
tex = new Texture2D(2, 2);
tex.LoadImage(fileData); //..this will auto-resize the texture dimensions.
}
return tex;
}
}
}

0 comments on commit ef18b88

Please sign in to comment.