VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
static Texture2D AVR.Core.Utils.Misc.Image2Texture ( string  path)
inlinestatic

Creates a Texture2D object from a given image path

Parameters
pathPath (relative to assembly) where the image is located. Example: "Packages/com.avr.core/Package_Resources/avr_logo_vr.png"
Returns

Definition at line 225 of file AVR_Utils.cs.

225  {
226  var rawData = System.IO.File.ReadAllBytes(path);
227  Texture2D tex = new Texture2D(1, 1); // Size should not matter here, as LoadImage resets it.
228  tex.LoadImage(rawData);
229  return tex;
230  }