Class EmbeddedResourceLoader
Unified resource loading from embedded assembly resources Supports loading textures, sprites, and raw bytes from manifest resources Use this class to load your embedded GLB file for custom models.
public static class EmbeddedResourceLoader
- Inheritance
-
EmbeddedResourceLoader
- Inherited Members
Methods
ListResources(Assembly?)
List all embedded resource names in an assembly
public static string[] ListResources(Assembly? assembly = null)
Parameters
assemblyAssemblyOptional assembly to check (defaults to calling assembly)
Returns
- string[]
Array of resource names
LoadBytes(string, Assembly?)
Load raw bytes from an embedded resource
public static byte[]? LoadBytes(string resourceName, Assembly? assembly = null)
Parameters
resourceNamestringThe fully qualified resource name
assemblyAssemblyOptional assembly to load from (defaults to calling assembly)
Returns
- byte[]
The resource bytes, or null if not found
LoadSprite(string, Assembly?, float)
Load a sprite from an embedded resource
public static Sprite? LoadSprite(string resourceName, Assembly? assembly = null, float pixelsPerUnit = 100)
Parameters
resourceNamestringThe fully qualified resource name (PNG or JPG)
assemblyAssemblyOptional assembly to load from (defaults to calling assembly)
pixelsPerUnitfloatPixels per unit for the sprite (default 100)
Returns
- Sprite
The loaded sprite, or null if loading failed
LoadTexture(string, Assembly?)
Load a texture from an embedded resource
public static Texture2D? LoadTexture(string resourceName, Assembly? assembly = null)
Parameters
resourceNamestringThe fully qualified resource name (PNG or JPG)
assemblyAssemblyOptional assembly to load from (defaults to calling assembly)
Returns
- Texture2D
The loaded texture, or null if loading failed
ResourceExists(string, Assembly?)
Check if an embedded resource exists
public static bool ResourceExists(string resourceName, Assembly? assembly = null)
Parameters
resourceNamestringThe fully qualified resource name
assemblyAssemblyOptional assembly to check (defaults to calling assembly)
Returns
- bool
True if the resource exists, false otherwise