Texture
Loads an image file (PNG, JPG, WebP) from the mounted project into a GPU texture. Used by Sprite. The path is resolved inside the game’s asset bundle (the same place Resource and shaders load from).
Texture
Section titled “Texture”Texture.load(path)
Section titled “Texture.load(path)”Returns: Texture — A texture handle (check valid).
Parameters:
path(String) — Image path within the mounted project, e.g."textures/hero.png".
import "engine" for Texture
var tex = Texture.load("textures/hero.png")if (!tex.valid) System.print("failed to load")Properties
Section titled “Properties”width— Image width in pixels (0if the load failed).height— Image height in pixels.valid—trueif the image loaded successfully.
System.print("%(tex.width) x %(tex.height)")Textures are cached by the renderer; loading the same path is cheap. See Sprite for drawing a texture as a billboarded quad.