Show / Hide Table of Contents

Class AssetUtils

Util functions related to loading assets at runtime.
Inheritance
System.Object
AssetUtils
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Jotunn.Utils
Assembly: Jotunn.dll
Syntax
public static class AssetUtils

Fields

| Improve this Doc View Source

AssetBundlePathSeparator

Path separator for AssetBundles
Declaration
public const char AssetBundlePathSeparator = '$'
Field Value
Type Description
System.Char

Methods

| Improve this Doc View Source

LoadAssetBundle(String)

Loads an asset bundle at runtime.
Declaration
public static AssetBundle LoadAssetBundle(string bundlePath)
Parameters
Type Name Description
System.String bundlePath Asset bundle path relative to "plugins" BepInEx folder
Returns
Type Description
AssetBundle AssetBundle loaded, or null if invalid path
| Improve this Doc View Source

LoadAssetBundleFromResources(String, Assembly)

Load an assembly-embedded
Declaration
public static AssetBundle LoadAssetBundleFromResources(string bundleName, Assembly resourceAssembly)
Parameters
Type Name Description
System.String bundleName Name of the bundle. Folders are point-seperated e.g. folder/bundle becomes folder.bundle
System.Reflection.Assembly resourceAssembly Executing assembly
Returns
Type Description
AssetBundle
| Improve this Doc View Source

LoadMesh(String)

Loads a mesh from a .obj file at runtime.
Declaration
public static Mesh LoadMesh(string meshPath)
Parameters
Type Name Description
System.String meshPath Mesh path relative to "plugins" BepInEx folder
Returns
Type Description
Mesh Texture2D loaded, or null if invalid path
| Improve this Doc View Source

LoadSprite(String)

Loads a from a file path or an asset bundle (separated by AssetBundlePathSeparator)
Declaration
public static Sprite LoadSprite(string assetPath)
Parameters
Type Name Description
System.String assetPath
Returns
Type Description
Sprite
| Improve this Doc View Source

LoadSpriteFromFile(String)

Loads a from file at runtime.
Declaration
public static Sprite LoadSpriteFromFile(string spritePath)
Parameters
Type Name Description
System.String spritePath Texture path relative to "plugins" BepInEx folder
Returns
Type Description
Sprite Texture2D loaded, or null if invalid path
| Improve this Doc View Source

LoadSpriteFromFile(String, Vector2)

Loads a from file at runtime.
Declaration
public static Sprite LoadSpriteFromFile(string spritePath, Vector2 pivot)
Parameters
Type Name Description
System.String spritePath Texture path relative to "plugins" BepInEx folder
Vector2 pivot The pivot to use in the resulting Sprite
Returns
Type Description
Sprite Texture2D loaded, or null if invalid path
| Improve this Doc View Source

LoadText(String)

Loads the contents of a file as a char string
Declaration
public static string LoadText(string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.String
| Improve this Doc View Source

LoadTextFromResources(String, Assembly)

Load an assembly-embedded file as a char string />
Declaration
public static string LoadTextFromResources(string fileName, Assembly resourceAssembly)
Parameters
Type Name Description
System.String fileName Name of the file. Folders are point-seperated e.g. folder/file.json becomes folder.file.json
System.Reflection.Assembly resourceAssembly Executing assembly
Returns
Type Description
System.String
| Improve this Doc View Source

LoadTexture(String, Boolean)

Loads a from file at runtime.
Declaration
public static Texture2D LoadTexture(string texturePath, bool relativePath = true)
Parameters
Type Name Description
System.String texturePath Texture path relative to "plugins" BepInEx folder
System.Boolean relativePath Is the given path relative
Returns
Type Description
Texture2D Texture2D loaded, or null if invalid path
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾